fixes Refresh Token UI incorrectly discarding expired (but refreshable) temp tokens

This commit is contained in:
nai-degen 2024-05-22 22:18:23 -05:00
parent 0418951928
commit 7d517a4c5f
1 changed files with 5 additions and 10 deletions

View File

@ -88,16 +88,11 @@
const data = JSON.parse(existingToken); const data = JSON.parse(existingToken);
const { token, expires } = data; const { token, expires } = data;
const expiresDate = new Date(expires); const expiresDate = new Date(expires);
const now = new Date();
if (expiresDate > now) {
document.getElementById( document.getElementById(
"existing-token-value" "existing-token-value"
).textContent = `Your token: ${token} (valid until ${expiresDate.toLocaleString()})`; ).textContent = `Your token: ${token} (valid until ${expiresDate.toLocaleString()})`;
document.getElementById("existing-token").style.display = "block"; document.getElementById("existing-token").style.display = "block";
document.getElementById("refresh-token").disabled = false; document.getElementById("refresh-token").disabled = false;
} else {
localStorage.removeItem("captcha-temp-token");
}
} }
const proxyKey = localStorage.getItem("captcha-proxy-key"); const proxyKey = localStorage.getItem("captcha-proxy-key");