refactor(auth): merge the duplicate login form and localize the auth screens
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 1m8s
CI / tests-integration (push) Successful in 1m53s
CI / tests-unit (push) Successful in 1m59s
CI / tests-ui (push) Successful in 2m42s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 4m33s
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 1m8s
CI / tests-integration (push) Successful in 1m53s
CI / tests-unit (push) Successful in 1m59s
CI / tests-ui (push) Successful in 2m42s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 4m33s
`home-login-form.tsx` and `login-form.tsx` were two ~240-line near-identical components. Delete the former and give `LoginForm` a `variant` prop: - `variant="page"` sr-only labels plus the register/forgot footer (/login) - `variant="compact"` visible labels, no footer (homepage sidebar) Field ids now come from `useId()`, so the two usages can never collide, and the hardcoded "Show"/"Hide"/"Loading" strings are translated. Localization of the login and register screens: - `home-login-form.tsx` was entirely hardcoded English. - `passwordStrength()` returned hardcoded "Weak"/"Fair"/"Good"/"Strong". - `register.ts` returned only English strings. It now returns a locale-independent `code` next to the message, and the form renders `t(code)` with the English string as a fallback. - Backfilled the new keys across all 25 locales, plus the login/register strings that were still English in most of them. `ar`, `fi` and `ja` had their entire login/register namespace in English and are now filled in. Locale parity stays at 0 missing keys, as `i18n:check` requires. Copy that did not match the enforced rules: the UI advertised "min 8 chars" (EN) / "min 6 tekens" (NL) while registration requires 12 characters plus an uppercase, a lowercase, a digit and a special character. Corrected in every locale. `password-reset.ts` enforced only 6 characters and is raised to 12 to match registration. Accessibility: `login-form.tsx` had no `<label>`, no `id` and no `required` on any field. All three are now present, and error banners are announced with `role="alert"`. Adds `src/i18n/auth-messages.test.ts`, which asserts every `RegisterErrorCode` resolves to a non-empty message in all 25 locales; verified it fails when a key is removed. The existing register tests now also assert the error `code`.
This commit is contained in:
1 parent
3d828a61ab
commit
6bffc53779
33 files changed
+1756
-842
No files matched your search
+42
-11
@@ -979,13 +979,17 @@
|
||||
"forgotPassword": "Password dimenticata?",
|
||||
"errorInvalidCredentials": "Nome utente o password non validi",
|
||||
"errorInvalid2fa": "Codice 2FA non valido",
|
||||
"errorUnverified": "Verifica la tua email prima di accedere.",
|
||||
"errorUnverified": "Verifica il tuo indirizzo email prima di accedere.",
|
||||
"errorCaptcha": "Verifica captcha non riuscita. Riprova.",
|
||||
"welcomeBack": "Bentornato",
|
||||
"welcomeBackSub": "Accedi per continuare su {hotelName}",
|
||||
"whoIsOnline": "Chi è online",
|
||||
"newestCitizens": "Nuovi cittadini",
|
||||
"usersOnline": "{count} online"
|
||||
"newestCitizens": "Cittadini più recenti",
|
||||
"usersOnline": "{count} online",
|
||||
"username": "Nome utente",
|
||||
"password": "Password",
|
||||
"showPassword": "Mostra",
|
||||
"hidePassword": "Nascondi"
|
||||
},
|
||||
"register": {
|
||||
"title": "Crea un account",
|
||||
@@ -996,7 +1000,7 @@
|
||||
"confirmPassword": "Ripeti la password",
|
||||
"usernamePlaceholder": "Nome utente",
|
||||
"emailPlaceholder": "Email",
|
||||
"passwordPlaceholder": "Password (min 6 caratteri)",
|
||||
"passwordPlaceholder": "Password (min 12 caratteri)",
|
||||
"confirmPasswordPlaceholder": "Ripeti la password",
|
||||
"selectOutfit": "Scegli il tuo outfit",
|
||||
"termsAccept": "Ho 18+ anni e accetto i termini e regole di {hotel}.",
|
||||
@@ -1008,7 +1012,7 @@
|
||||
"termsError": "Devi accettare i termini e regole per registrarti.",
|
||||
"usernameError": "Il nome utente è obbligatorio.",
|
||||
"emailError": "Email valida obbligatoria.",
|
||||
"passwordError": "La password deve essere di almeno 6 caratteri.",
|
||||
"passwordError": "La password deve contenere almeno 12 caratteri",
|
||||
"confirmPasswordError": "Le password non coincidono.",
|
||||
"termsRequired": "Devi accettare i termini e le regole.",
|
||||
"usernameRequired": "Il nome utente è obbligatorio.",
|
||||
@@ -1018,15 +1022,40 @@
|
||||
"alreadyHaveAccountPre": "Hai già un account?",
|
||||
"alreadyHaveAccountLink": "Accedi",
|
||||
"whoIsOnline": "Chi è online",
|
||||
"newestCitizens": "Nuovi cittadini",
|
||||
"newestCitizens": "Cittadini più recenti",
|
||||
"usersOnline": "{count} online",
|
||||
"accepted": "Accettato e confermato",
|
||||
"accepted": "Accettato e d'accordo",
|
||||
"showPassword": "Mostra",
|
||||
"hidePassword": "Nascondi",
|
||||
"accountDetails": "Dettagli dell’account",
|
||||
"accountDetails": "Dati account",
|
||||
"credentials": "Credenziali e sicurezza",
|
||||
"ageVerified": "Ho 18+ e accetto il requisito di età.",
|
||||
"invitedBy": "Invitato da {username}"
|
||||
"invitedBy": "Invitato da {username}",
|
||||
"strengthWeak": "Debole",
|
||||
"strengthFair": "Discreta",
|
||||
"strengthGood": "Buona",
|
||||
"strengthStrong": "Forte",
|
||||
"passwordMinLength": "La password deve contenere almeno 12 caratteri",
|
||||
"passwordUpper": "La password deve contenere almeno una lettera maiuscola",
|
||||
"passwordLower": "La password deve contenere almeno una lettera minuscola",
|
||||
"passwordDigit": "La password deve contenere almeno una cifra",
|
||||
"passwordSpecial": "La password deve contenere almeno un carattere speciale",
|
||||
"passwordMaxLength": "La password è troppo lunga",
|
||||
"usernameMinLength": "Il nome utente deve contenere almeno 3 caratteri",
|
||||
"usernameMaxLength": "Il nome utente può contenere al massimo 25 caratteri",
|
||||
"usernamePattern": "Il nome utente può contenere solo lettere, numeri, underscore e trattino",
|
||||
"usernameReserved": "Questo nome utente è riservato",
|
||||
"emailValid": "Inserisci un indirizzo email valido",
|
||||
"emailDisposable": "I domini email temporanei non sono consentiti",
|
||||
"passwordsMatch": "Le password non coincidono.",
|
||||
"captchaFailed": "Verifica captcha non riuscita. Riprova.",
|
||||
"usernameTaken": "Questo nome utente è già in uso",
|
||||
"rateLimited": "Troppi tentativi di registrazione. Attendi qualche minuto e riprova.",
|
||||
"vpnBlocked": "Le registrazioni tramite connessioni VPN/proxy non sono consentite.",
|
||||
"maxAccountsPerIp": "Hai raggiunto il numero massimo di account per la tua connessione.",
|
||||
"unavailable": "La registrazione è temporaneamente non disponibile.",
|
||||
"createFailed": "Impossibile creare l'account. Riprova o contatta lo staff.",
|
||||
"invalidInput": "Controlla i campi evidenziati e riprova."
|
||||
},
|
||||
"forgot": {
|
||||
"title": "Reimposta password",
|
||||
@@ -1040,9 +1069,11 @@
|
||||
"reset": {
|
||||
"title": "Imposta una nuova password",
|
||||
"subtitle": "Scegli una password robusta che non usi altrove.",
|
||||
"passwordPlaceholder": "Nuova password (min 6 caratteri)",
|
||||
"passwordPlaceholder": "Nuova password (min 12 caratteri)",
|
||||
"resetPassword": "Reimposta password",
|
||||
"backToLogin": "Torna all'accesso"
|
||||
"backToLogin": "Torna all'accesso",
|
||||
"passwordMinLength": "La password deve contenere almeno 12 caratteri",
|
||||
"tooManyAttempts": "Troppi tentativi — riprova più tardi"
|
||||
},
|
||||
"verify": {
|
||||
"verifiedTitle": "È tutto pronto",
|
||||
|
||||
Reference in new issue
Block a user