fix: update 2FA support descriptions and improve error handling in TOTP actions

This commit is contained in:
shuaiplus
2026-03-02 22:36:10 +08:00
parent 16a7bcace9
commit 4da5525a1a
7 changed files with 19 additions and 17 deletions
+8 -4
View File
@@ -55,10 +55,14 @@ export default function SettingsPage(props: SettingsPageProps) {
}, [props.profile.email, secret]);
async function enableTotp(): Promise<void> {
await props.onEnableTotp(secret, token);
// Secret is now stored on the server; remove plaintext copy from localStorage.
localStorage.removeItem(totpSecretStorageKey);
setTotpLocked(true);
try {
await props.onEnableTotp(secret, token);
// Secret is now stored on the server; remove plaintext copy from localStorage.
localStorage.removeItem(totpSecretStorageKey);
setTotpLocked(true);
} catch {
// Keep inputs editable after a failed attempt.
}
}
async function loadRecoveryCode(): Promise<void> {