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

`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:
openhands committed 2026-10-04 18:50:23 +02:00
1 parent 3d828a61ab
commit 6bffc53779
33 files changed
+1756 -842

No files matched your search

+45 -14
View File
@@ -1013,9 +1013,13 @@
"errorCaptcha": "Captcha-verificatie mislukt. Probeer het opnieuw.",
"welcomeBack": "Welkom terug",
"welcomeBackSub": "Log in om verder te gaan naar {hotelName}",
"whoIsOnline": "Who's online",
"newestCitizens": "Newest citizens",
"usersOnline": "{count} online"
"whoIsOnline": "Wie is online",
"newestCitizens": "Nieuwste burgers",
"usersOnline": "{count} online",
"showPassword": "Toon",
"hidePassword": "Verberg",
"username": "Gebruikersnaam",
"password": "Wachtwoord"
},
"register": {
"title": "Account aanmaken",
@@ -1026,7 +1030,7 @@
"confirmPassword": "Wachtwoord herhalen",
"usernamePlaceholder": "Gebruikersnaam",
"emailPlaceholder": "E-mail",
"passwordPlaceholder": "Wachtwoord (min 6 tekens)",
"passwordPlaceholder": "Wachtwoord (min 12 tekens)",
"confirmPasswordPlaceholder": "Wachtwoord herhalen",
"selectOutfit": "Kies je outfit",
"termsAccept": "Ik ben 18+ en accepteer de {hotel} voorwaarden & regels.",
@@ -1042,21 +1046,46 @@
"termsError": "Je moet de voorwaarden & regels accepteren om te registreren.",
"usernameError": "Gebruikersnaam is verplicht.",
"emailError": "Een geldig e-mailadres is verplicht.",
"passwordError": "Wachtwoord moet minimaal 6 tekens bevatten.",
"passwordError": "Wachtwoord moet minimaal 12 tekens lang zijn",
"confirmPasswordError": "Wachtwoorden komen niet overeen.",
"termsRequired": "Je moet de voorwaarden & regels accepteren.",
"termsRequired": "Je moet de voorwaarden accepteren.",
"ageVerified": "Ik ben 18+ en ga akkoord met de leeftijdsvereiste.",
"usernameRequired": "Gebruikersnaam is verplicht.",
"emailRequired": "E-mail is verplicht.",
"passwordRequired": "Wachtwoord is verplicht.",
"passwordsDontMatch": "Wachtwoorden komen niet overeen.",
"invitedBy": "Uitgenodigd door {username}",
"accepted": "Accepted & agreed",
"showPassword": "Show",
"hidePassword": "Hide",
"accountDetails": "Account details",
"credentials": "Credentials & security",
"newestCitizens": "Newest citizens"
"accepted": "Geaccepteerd & akkoord",
"showPassword": "Toon",
"hidePassword": "Verberg",
"accountDetails": "Accountgegevens",
"credentials": "Gegevens & beveiliging",
"newestCitizens": "Nieuwste burgers",
"strengthWeak": "Zwak",
"strengthFair": "Redelijk",
"strengthGood": "Goed",
"strengthStrong": "Sterk",
"passwordMinLength": "Wachtwoord moet minimaal 12 tekens lang zijn",
"passwordUpper": "Wachtwoord moet minstens één hoofdletter bevatten",
"passwordLower": "Wachtwoord moet minstens één kleine letter bevatten",
"passwordDigit": "Wachtwoord moet minstens één cijfer bevatten",
"passwordSpecial": "Wachtwoord moet minstens één speciaal teken bevatten",
"passwordMaxLength": "Wachtwoord is te lang",
"usernameMinLength": "Gebruikersnaam moet minimaal 3 tekens lang zijn",
"usernameMaxLength": "Gebruikersnaam mag maximaal 25 tekens lang zijn",
"usernamePattern": "Gebruikersnaam mag alleen letters, cijfers, underscore en streepje bevatten",
"usernameReserved": "Deze gebruikersnaam is gereserveerd",
"emailValid": "Voer een geldig e-mailadres in",
"emailDisposable": "Tijdelijke e-maildomeinen zijn niet toegestaan",
"passwordsMatch": "Wachtwoorden komen niet overeen",
"usernameTaken": "Deze gebruikersnaam is al in gebruik",
"captchaFailed": "Captcha-verificatie mislukt. Probeer het opnieuw.",
"rateLimited": "Te veel registratiepogingen. Wacht een paar minuten en probeer het opnieuw.",
"vpnBlocked": "Registraties via VPN/proxy-verbindingen zijn niet toegestaan.",
"maxAccountsPerIp": "Je hebt het maximale aantal accounts voor je verbinding bereikt.",
"unavailable": "Registratie is tijdelijk niet beschikbaar.",
"createFailed": "Het account kon niet worden aangemaakt. Probeer het opnieuw of neem contact op met het personeel.",
"invalidInput": "Controleer de gemarkeerde velden en probeer het opnieuw."
},
"forgot": {
"title": "Wachtwoord resetten",
@@ -1070,9 +1099,11 @@
"reset": {
"title": "Nieuw wachtwoord instellen",
"subtitle": "Kies een sterk wachtwoord dat je nergens anders gebruikt.",
"passwordPlaceholder": "Nieuw wachtwoord (min 6 tekens)",
"passwordPlaceholder": "Nieuw wachtwoord (min 12 tekens)",
"resetPassword": "Wachtwoord resetten",
"backToLogin": "Terug naar inloggen"
"backToLogin": "Terug naar inloggen",
"passwordMinLength": "Wachtwoord moet minimaal 12 tekens lang zijn",
"tooManyAttempts": "Te veel pogingen — probeer het later opnieuw"
},
"verify": {
"verifiedTitle": "Je bent helemaal klaar",