refactor(login): type auth errors with status-code-based enum

Replace the raw errorMessage string in the login view state with a
typed LegacyAuthErrorEvent that classifies backend failures by HTTP
status (403/404 → invalidCredentials, 423 → accountLocked, 401 +
NOT_VERIFIED/expired → dedicated events, 429 → tooManyAttempts,
timeout → network). The login screen and 2FA sheet now switch on the
enum to show specific i18n messages instead of surfacing raw backend
text. Adds auth i18n keys for the full set of mapped states.
This commit is contained in:
2026-04-17 11:11:23 +02:00
parent eff6f01924
commit 56d89fcdc4
13 changed files with 192 additions and 38 deletions

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "Keine 2FA-Methoden verfügbar.",
"errorTwoFactorResendFailed": "Fehler beim erneuten Senden des Codes.",
"loginSuccess": "Anmeldung erfolgreich",
"authErrorInvalidCredentials": "E-Mail oder Passwort ist falsch.",
"authErrorAccountLocked": "Ihr Konto ist vorübergehend gesperrt. Versuchen Sie es später erneut.",
"authErrorAccountNotVerified": "Ihr Konto ist noch nicht verifiziert. Bitte prüfen Sie Ihre E-Mails.",
"authErrorPasswordExpired": "Ihr Passwort ist abgelaufen. Verwenden Sie 'Passwort vergessen', um es zurückzusetzen.",
"authErrorInvalidToken": "Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.",
"authErrorTooManyAttempts": "Zu viele Versuche. Bitte warten Sie einige Minuten und versuchen Sie es erneut.",
"authErrorNetwork": "Keine Verbindung. Überprüfen Sie Ihr Netzwerk und versuchen Sie es erneut.",
"stepUserContactSupertitle": "Benutzer und Kontakt",
"stepUserContactTitle": "Erstelle dein Konto",
"stepUserContactSubtitle": "Mit deiner E-Mail und deiner Telefonnummer können wir dich jederzeit informieren",
@@ -863,6 +870,7 @@
"locateDeviceInstructions": "1. Drücken Sie die Schaltfläche Ton abspielen, um den Ton auf dem Gerät zu aktivieren.\n2. Drücken Sie OK\n3. Das Gerät spielt einen Ton ab\n4. Das Gerät beginnt nach Erhalt der Anweisungen zu klingeln",
"mapTitle": "Karte",
"logOut": "Abmelden",
"logOutConfirm": "Möchten Sie sich wirklich abmelden?",
"loginEmail": "(E-Mail)",
"makeFriends": "Freunde finden",
"male": "Männlich",

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "No 2FA methods available.",
"errorTwoFactorResendFailed": "Error resending code.",
"loginSuccess": "Login successful",
"authErrorInvalidCredentials": "Incorrect email or password.",
"authErrorAccountLocked": "Your account is temporarily locked. Try again later.",
"authErrorAccountNotVerified": "Your account is not verified yet. Check your email.",
"authErrorPasswordExpired": "Your password has expired. Use 'Forgot password' to reset it.",
"authErrorInvalidToken": "Your session has expired. Please log in again.",
"authErrorTooManyAttempts": "Too many attempts. Please wait a few minutes and try again.",
"authErrorNetwork": "No connection. Check your network and try again.",
"stepUserContactSupertitle": "User & contact",
"stepUserContactTitle": "Create your account",
"stepUserContactSubtitle": "With your email and phone number we can keep you informed at all times",
@@ -507,6 +514,7 @@
"regCode": "Device registration code",
"deleteAccount": "Delete account",
"logOut": "Log out",
"logOutConfirm": "Are you sure you want to log out?",
"loginEmail": "(Login email)",
"submit": "Submit",
"save": "Save",

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "No hay métodos 2FA disponibles.",
"errorTwoFactorResendFailed": "Error al reenviar el código.",
"loginSuccess": "Inicio de sesión exitoso",
"authErrorInvalidCredentials": "Email o contraseña incorrectos.",
"authErrorAccountLocked": "Tu cuenta está bloqueada temporalmente. Intenta más tarde.",
"authErrorAccountNotVerified": "Tu cuenta aún no está verificada. Revisa tu email.",
"authErrorPasswordExpired": "Tu contraseña ha caducado. Recupérala desde 'Olvidé mi contraseña'.",
"authErrorInvalidToken": "La sesión ha caducado. Vuelve a iniciar sesión.",
"authErrorTooManyAttempts": "Demasiados intentos. Espera unos minutos e inténtalo de nuevo.",
"authErrorNetwork": "No hay conexión. Comprueba tu red e inténtalo de nuevo.",
"stepUserContactSupertitle": "Usuario y contacto",
"stepUserContactTitle": "Crea tu usuario",
"stepUserContactSubtitle": "Con tu email y tu número podremos mantenerte siempre informado",
@@ -506,6 +513,7 @@
"regCode": "Código de registro del dispositivo",
"deleteAccount": "Eliminar cuenta",
"logOut": "Cerrar sesión",
"logOutConfirm": "¿Estás seguro de que quieres cerrar sesión?",
"loginEmail": "(Correo electrónico)",
"passwordLabel": "Contraseña (de 6 a 12 caracteres)",
"submit": "Enviar",

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "Aucune méthode 2FA disponible.",
"errorTwoFactorResendFailed": "Erreur lors du renvoi du code.",
"loginSuccess": "Connexion réussie",
"authErrorInvalidCredentials": "E-mail ou mot de passe incorrect.",
"authErrorAccountLocked": "Votre compte est temporairement verrouillé. Réessayez plus tard.",
"authErrorAccountNotVerified": "Votre compte n'est pas encore vérifié. Consultez vos e-mails.",
"authErrorPasswordExpired": "Votre mot de passe a expiré. Utilisez 'Mot de passe oublié' pour le réinitialiser.",
"authErrorInvalidToken": "Votre session a expiré. Veuillez vous reconnecter.",
"authErrorTooManyAttempts": "Trop de tentatives. Patientez quelques minutes avant de réessayer.",
"authErrorNetwork": "Pas de connexion. Vérifiez votre réseau et réessayez.",
"stepUserContactSupertitle": "Utilisateur et contact",
"stepUserContactTitle": "Crée ton compte",
"stepUserContactSubtitle": "Avec ton e-mail et ton numéro, nous pourrons te tenir informé à tout moment",
@@ -863,6 +870,7 @@
"locateDeviceInstructions": "1. Appuyez sur le bouton Lire le son pour activer le son sur l'appareil.\n2. Appuyez sur OK\n3. L'appareil émettra un son\n4. L'appareil commencera à sonner après avoir reçu les instructions",
"mapTitle": "Carte",
"logOut": "Se déconnecter",
"logOutConfirm": "Êtes-vous sûr de vouloir vous déconnecter ?",
"loginEmail": "(E-mail)",
"makeFriends": "Se faire des amis",
"male": "Homme",

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "Nessun metodo 2FA disponibile.",
"errorTwoFactorResendFailed": "Errore durante il reinvio del codice.",
"loginSuccess": "Accesso riuscito",
"authErrorInvalidCredentials": "Email o password errati.",
"authErrorAccountLocked": "Il tuo account è temporaneamente bloccato. Riprova più tardi.",
"authErrorAccountNotVerified": "Il tuo account non è ancora verificato. Controlla la tua email.",
"authErrorPasswordExpired": "La tua password è scaduta. Usa 'Password dimenticata' per reimpostarla.",
"authErrorInvalidToken": "La tua sessione è scaduta. Accedi di nuovo.",
"authErrorTooManyAttempts": "Troppi tentativi. Attendi qualche minuto e riprova.",
"authErrorNetwork": "Nessuna connessione. Controlla la tua rete e riprova.",
"stepUserContactSupertitle": "Utente e contatti",
"stepUserContactTitle": "Crea il tuo account",
"stepUserContactSubtitle": "Con la tua email e il tuo numero potremo tenerti sempre informato",
@@ -863,6 +870,7 @@
"locateDeviceInstructions": "1. Premi il pulsante Riproduci suono per attivare il suono sul dispositivo.\n2. Premi OK\n3. Il dispositivo riprodurrà un suono\n4. Il dispositivo inizierà a suonare dopo aver ricevuto le istruzioni",
"mapTitle": "Mappa",
"logOut": "Disconnetti",
"logOutConfirm": "Sei sicuro di voler disconnetterti?",
"loginEmail": "(Email)",
"makeFriends": "Fare amicizia",
"male": "Uomo",

View File

@@ -76,6 +76,13 @@
"errorTwoFactorNoMethods": "Nenhum método 2FA disponível.",
"errorTwoFactorResendFailed": "Erro ao reenviar o código.",
"loginSuccess": "Login realizado com sucesso",
"authErrorInvalidCredentials": "Email ou palavra-passe incorretos.",
"authErrorAccountLocked": "A tua conta está temporariamente bloqueada. Tenta mais tarde.",
"authErrorAccountNotVerified": "A tua conta ainda não está verificada. Verifica o teu email.",
"authErrorPasswordExpired": "A tua palavra-passe expirou. Usa 'Esqueci a palavra-passe' para a redefinir.",
"authErrorInvalidToken": "A tua sessão expirou. Volta a iniciar sessão.",
"authErrorTooManyAttempts": "Demasiadas tentativas. Aguarda alguns minutos e tenta novamente.",
"authErrorNetwork": "Sem ligação. Verifica a tua rede e tenta novamente.",
"stepUserContactSupertitle": "Utilizador e contacto",
"stepUserContactTitle": "Cria a tua conta",
"stepUserContactSubtitle": "Com o teu email e o teu número poderemos manter-te sempre informado",
@@ -863,6 +870,7 @@
"locateDeviceInstructions": "1. Pressione o botão Reproduzir Som para ativar o som no dispositivo.\n2. Pressione OK\n3. O dispositivo reproduzirá um som\n4. O dispositivo começará a tocar após receber as instruções",
"mapTitle": "Mapa",
"logOut": "Sair",
"logOutConfirm": "Tem certeza de que deseja sair?",
"loginEmail": "(E-mail)",
"makeFriends": "Fazer amigos",
"male": "Homem",