fix toggleRecovery text

This commit is contained in:
Ryan
2025-04-06 14:46:37 -04:00
committed by GitHub
parent 70163d22f0
commit 4f74090818

View File

@@ -55,12 +55,23 @@ export function openTOTPLoginModal() {
}); });
// Toggle between TOTP and Recovery // Toggle between TOTP and Recovery
document.getElementById("toggleRecovery").addEventListener("click", e => { document.getElementById("toggleRecovery").addEventListener("click", function (e) {
e.preventDefault(); e.preventDefault();
document.getElementById("totpSection").style.display = const totpSection = document.getElementById("totpSection");
document.getElementById("recoverySection").style.display === "none" ? "none" : "block"; const recoverySection = document.getElementById("recoverySection");
document.getElementById("recoverySection").style.display = const toggleLink = this;
document.getElementById("recoverySection").style.display === "none" ? "block" : "none";
if (recoverySection.style.display === "none") {
// Switch to recovery
totpSection.style.display = "none";
recoverySection.style.display = "block";
toggleLink.textContent = "Use TOTP Code instead";
} else {
// Switch back to TOTP
recoverySection.style.display = "none";
totpSection.style.display = "block";
toggleLink.textContent = "Use Recovery Code instead";
}
}); });
// Recovery submission // Recovery submission
@@ -409,7 +420,7 @@ export function closeTOTPModal(disable = true) {
}) })
.catch(() => { showToast("Error disabling TOTP setting."); }); .catch(() => { showToast("Error disabling TOTP setting."); });
} }
} }
export function openAdminPanel() { export function openAdminPanel() {
fetch("getConfig.php", { credentials: "include" }) fetch("getConfig.php", { credentials: "include" })