fix(mfa-backup-codes): persist backup codes panel after enable and refresh

Keep MFA backup codes visible after enabling MFA by avoiding protected-route unmount during user reload (`loadUser({ silent: true })`) and restoring pending backup codes from sessionStorage until the user explicitly dismisses them.
This commit is contained in:
fgbona
2026-03-30 18:22:45 -03:00
parent 8412f303dd
commit de444bf770
20 changed files with 251 additions and 20 deletions

View File

@@ -226,6 +226,13 @@ const ar: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'فشل الرفع',
'settings.mfa.title': 'المصادقة الثنائية (2FA)',
'settings.mfa.description': 'تضيف خطوة ثانية عند تسجيل الدخول. استخدم تطبيق مصادقة (Google Authenticator، Authy، إلخ).',
'settings.mfa.backupTitle': 'رموز النسخ الاحتياطي',
'settings.mfa.backupDescription': 'استخدم هذه الرموز لمرة واحدة إذا فقدت الوصول إلى تطبيق المصادقة.',
'settings.mfa.backupWarning': 'احفظ هذه الرموز الآن. كل رمز يمكن استخدامه مرة واحدة فقط.',
'settings.mfa.backupCopy': 'نسخ الرموز',
'settings.mfa.backupDownload': 'تنزيل TXT',
'settings.mfa.backupPrint': 'طباعة / PDF',
'settings.mfa.backupCopied': 'تم نسخ رموز النسخ الاحتياطي',
'settings.mfa.enabled': 'المصادقة الثنائية مفعّلة على حسابك.',
'settings.mfa.disabled': 'المصادقة الثنائية غير مفعّلة.',
'settings.mfa.setup': 'إعداد المصادقة',

View File

@@ -221,6 +221,13 @@ const br: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Falha no envio',
'settings.mfa.title': 'Autenticação em duas etapas (2FA)',
'settings.mfa.description': 'Adiciona uma segunda etapa ao entrar com e-mail e senha. Use um app autenticador (Google Authenticator, Authy, etc.).',
'settings.mfa.backupTitle': 'Códigos de backup',
'settings.mfa.backupDescription': 'Use estes códigos únicos se perder acesso ao app autenticador.',
'settings.mfa.backupWarning': 'Salve estes códigos agora. Cada código pode ser usado apenas uma vez.',
'settings.mfa.backupCopy': 'Copiar códigos',
'settings.mfa.backupDownload': 'Baixar TXT',
'settings.mfa.backupPrint': 'Imprimir / PDF',
'settings.mfa.backupCopied': 'Códigos de backup copiados',
'settings.mfa.enabled': 'O 2FA está ativado na sua conta.',
'settings.mfa.disabled': 'O 2FA não está ativado.',
'settings.mfa.setup': 'Configurar autenticador',

View File

@@ -188,6 +188,13 @@ const cs: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Nahrávání se nezdařilo',
'settings.mfa.title': 'Dvoufaktorové ověření (2FA)',
'settings.mfa.description': 'Přidá druhý stupeň zabezpečení při přihlašování e-mailem a heslem. Použijte aplikaci (Google Authenticator, Authy apod.).',
'settings.mfa.backupTitle': 'Záložní kódy',
'settings.mfa.backupDescription': 'Použijte tyto jednorázové kódy, pokud ztratíte přístup k autentizační aplikaci.',
'settings.mfa.backupWarning': 'Uložte si je hned. Každý kód lze použít pouze jednou.',
'settings.mfa.backupCopy': 'Kopírovat kódy',
'settings.mfa.backupDownload': 'Stáhnout TXT',
'settings.mfa.backupPrint': 'Tisk / PDF',
'settings.mfa.backupCopied': 'Záložní kódy zkopírovány',
'settings.mfa.enabled': '2FA je pro váš účet aktivní.',
'settings.mfa.disabled': '2FA není aktivní.',
'settings.mfa.setup': 'Nastavit autentizační aplikaci',

View File

@@ -221,6 +221,13 @@ const de: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Fehler beim Hochladen',
'settings.mfa.title': 'Zwei-Faktor-Authentifizierung (2FA)',
'settings.mfa.description': 'Zusätzlicher Schritt bei der Anmeldung mit E-Mail und Passwort. Nutze eine Authenticator-App (Google Authenticator, Authy, …).',
'settings.mfa.backupTitle': 'Backup-Codes',
'settings.mfa.backupDescription': 'Verwende diese Einmal-Codes, wenn du keinen Zugriff mehr auf deine Authenticator-App hast.',
'settings.mfa.backupWarning': 'Jetzt speichern. Jeder Code kann nur einmal verwendet werden.',
'settings.mfa.backupCopy': 'Codes kopieren',
'settings.mfa.backupDownload': 'TXT herunterladen',
'settings.mfa.backupPrint': 'Drucken / PDF',
'settings.mfa.backupCopied': 'Backup-Codes kopiert',
'settings.mfa.enabled': '2FA ist für dein Konto aktiv.',
'settings.mfa.disabled': '2FA ist nicht aktiviert.',
'settings.mfa.setup': 'Authenticator einrichten',

View File

@@ -221,6 +221,13 @@ const en: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Upload failed',
'settings.mfa.title': 'Two-factor authentication (2FA)',
'settings.mfa.description': 'Adds a second step when you sign in with email and password. Use an authenticator app (Google Authenticator, Authy, etc.).',
'settings.mfa.backupTitle': 'Backup codes',
'settings.mfa.backupDescription': 'Use these one-time backup codes if you lose access to your authenticator app.',
'settings.mfa.backupWarning': 'Save these codes now. Each code can only be used once.',
'settings.mfa.backupCopy': 'Copy codes',
'settings.mfa.backupDownload': 'Download TXT',
'settings.mfa.backupPrint': 'Print / PDF',
'settings.mfa.backupCopied': 'Backup codes copied',
'settings.mfa.enabled': '2FA is enabled on your account.',
'settings.mfa.disabled': '2FA is not enabled.',
'settings.mfa.setup': 'Set up authenticator',

View File

@@ -211,6 +211,13 @@ const es: Record<string, string> = {
'settings.saveProfile': 'Guardar perfil',
'settings.mfa.title': 'Autenticación de dos factores (2FA)',
'settings.mfa.description': 'Añade un segundo paso al iniciar sesión. Usa una app de autenticación (Google Authenticator, Authy, etc.).',
'settings.mfa.backupTitle': 'Códigos de respaldo',
'settings.mfa.backupDescription': 'Usa estos códigos de un solo uso si pierdes acceso a tu app autenticadora.',
'settings.mfa.backupWarning': 'Guárdalos ahora. Cada código solo se puede usar una vez.',
'settings.mfa.backupCopy': 'Copiar códigos',
'settings.mfa.backupDownload': 'Descargar TXT',
'settings.mfa.backupPrint': 'Imprimir / PDF',
'settings.mfa.backupCopied': 'Códigos de respaldo copiados',
'settings.mfa.enabled': '2FA está activado en tu cuenta.',
'settings.mfa.disabled': '2FA no está activado.',
'settings.mfa.setup': 'Configurar autenticador',

View File

@@ -212,6 +212,13 @@ const fr: Record<string, string> = {
'settings.saveProfile': 'Enregistrer le profil',
'settings.mfa.title': 'Authentification à deux facteurs (2FA)',
'settings.mfa.description': 'Ajoute une étape supplémentaire lors de la connexion. Utilisez une application d\'authentification (Google Authenticator, Authy, etc.).',
'settings.mfa.backupTitle': 'Codes de secours',
'settings.mfa.backupDescription': 'Utilisez ces codes à usage unique si vous perdez l\'accès à votre application d\'authentification.',
'settings.mfa.backupWarning': 'Enregistrez ces codes maintenant. Chaque code n\'est utilisable qu\'une seule fois.',
'settings.mfa.backupCopy': 'Copier les codes',
'settings.mfa.backupDownload': 'Télécharger TXT',
'settings.mfa.backupPrint': 'Imprimer / PDF',
'settings.mfa.backupCopied': 'Codes de secours copiés',
'settings.mfa.enabled': '2FA est activé sur votre compte.',
'settings.mfa.disabled': '2FA n\'est pas activé.',
'settings.mfa.setup': 'Configurer l\'authentificateur',

View File

@@ -187,6 +187,13 @@ const hu: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Feltöltés sikertelen',
'settings.mfa.title': 'Kétfaktoros hitelesítés (2FA)',
'settings.mfa.description': 'Egy második lépést ad a bejelentkezéshez e-mail és jelszó használatakor. Használj hitelesítő alkalmazást (Google Authenticator, Authy stb.).',
'settings.mfa.backupTitle': 'Tartalék kódok',
'settings.mfa.backupDescription': 'Használd ezeket az egyszer használatos kódokat, ha elveszíted a hozzáférést a hitelesítő alkalmazásodhoz.',
'settings.mfa.backupWarning': 'Mentsd el ezeket most. Minden kód csak egyszer használható.',
'settings.mfa.backupCopy': 'Kódok másolása',
'settings.mfa.backupDownload': 'TXT letöltése',
'settings.mfa.backupPrint': 'Nyomtatás / PDF',
'settings.mfa.backupCopied': 'Tartalék kódok másolva',
'settings.mfa.enabled': '2FA engedélyezve van a fiókodban.',
'settings.mfa.disabled': '2FA nincs engedélyezve.',
'settings.mfa.setup': 'Hitelesítő beállítása',
@@ -608,7 +615,6 @@ const hu: Record<string, string | { name: string; category: string }[]> = {
'atlas.statsTab': 'Statisztikák',
'atlas.bucketTab': 'Bakancslista',
'atlas.addBucket': 'Hozzáadás a bakancslistához',
'atlas.bucketNamePlaceholder': 'Hely vagy úti cél...',
'atlas.bucketNotesPlaceholder': 'Jegyzetek (opcionális)',
'atlas.bucketEmpty': 'A bakancslistád üres',
'atlas.bucketEmptyHint': 'Adj hozzá helyeket, ahová álmodsz eljutni',

View File

@@ -187,6 +187,13 @@ const it: Record<string, string | { name: string; category: string }[]> = {
'settings.avatarError': 'Impossibile caricare',
'settings.mfa.title': 'Autenticazione a due fattori (2FA)',
'settings.mfa.description': 'Aggiunge un secondo passaggio quando accedi con email e password. Usa un\'app authenticator (Google Authenticator, Authy, ecc.).',
'settings.mfa.backupTitle': 'Codici di backup',
'settings.mfa.backupDescription': 'Usa questi codici monouso se perdi l\'accesso alla tua app authenticator.',
'settings.mfa.backupWarning': 'Salvali adesso. Ogni codice può essere usato una sola volta.',
'settings.mfa.backupCopy': 'Copia codici',
'settings.mfa.backupDownload': 'Scarica TXT',
'settings.mfa.backupPrint': 'Stampa / PDF',
'settings.mfa.backupCopied': 'Codici di backup copiati',
'settings.mfa.enabled': 'La 2FA è abilitata sul tuo account.',
'settings.mfa.disabled': 'La 2FA non è abilitata.',
'settings.mfa.setup': 'Configura authenticator',

View File

@@ -212,6 +212,13 @@ const nl: Record<string, string> = {
'settings.saveProfile': 'Profiel opslaan',
'settings.mfa.title': 'Tweefactorauthenticatie (2FA)',
'settings.mfa.description': 'Voegt een tweede stap toe bij het inloggen. Gebruik een authenticator-app (Google Authenticator, Authy, etc.).',
'settings.mfa.backupTitle': 'Back-upcodes',
'settings.mfa.backupDescription': 'Gebruik deze eenmalige codes als je geen toegang meer hebt tot je authenticator-app.',
'settings.mfa.backupWarning': 'Sla deze codes nu op. Elke code kan maar een keer worden gebruikt.',
'settings.mfa.backupCopy': 'Codes kopiëren',
'settings.mfa.backupDownload': 'TXT downloaden',
'settings.mfa.backupPrint': 'Afdrukken / PDF',
'settings.mfa.backupCopied': 'Back-upcodes gekopieerd',
'settings.mfa.enabled': '2FA is ingeschakeld op je account.',
'settings.mfa.disabled': '2FA is niet ingeschakeld.',
'settings.mfa.setup': 'Authenticator instellen',

View File

@@ -212,6 +212,13 @@ const ru: Record<string, string> = {
'settings.saveProfile': 'Сохранить профиль',
'settings.mfa.title': 'Двухфакторная аутентификация (2FA)',
'settings.mfa.description': 'Добавляет второй шаг при входе. Используйте приложение-аутентификатор (Google Authenticator, Authy и др.).',
'settings.mfa.backupTitle': 'Резервные коды',
'settings.mfa.backupDescription': 'Используйте эти одноразовые коды, если потеряете доступ к приложению-аутентификатору.',
'settings.mfa.backupWarning': 'Сохраните их сейчас. Каждый код можно использовать только один раз.',
'settings.mfa.backupCopy': 'Скопировать коды',
'settings.mfa.backupDownload': 'Скачать TXT',
'settings.mfa.backupPrint': 'Печать / PDF',
'settings.mfa.backupCopied': 'Резервные коды скопированы',
'settings.mfa.enabled': '2FA включена для вашего аккаунта.',
'settings.mfa.disabled': '2FA не включена.',
'settings.mfa.setup': 'Настроить аутентификатор',

View File

@@ -212,6 +212,13 @@ const zh: Record<string, string> = {
'settings.saveProfile': '保存资料',
'settings.mfa.title': '双因素认证 (2FA)',
'settings.mfa.description': '登录时添加第二步验证。使用身份验证器应用Google Authenticator、Authy 等)。',
'settings.mfa.backupTitle': '备用代码',
'settings.mfa.backupDescription': '如果你无法使用身份验证器应用,可使用这些一次性备用代码登录。',
'settings.mfa.backupWarning': '请立即保存这些代码。每个代码只能使用一次。',
'settings.mfa.backupCopy': '复制代码',
'settings.mfa.backupDownload': '下载 TXT',
'settings.mfa.backupPrint': '打印 / PDF',
'settings.mfa.backupCopied': '备用代码已复制',
'settings.mfa.enabled': '您的账户已启用 2FA。',
'settings.mfa.disabled': '2FA 未启用。',
'settings.mfa.setup': '设置身份验证器',