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
+94
-63
@@ -6067,69 +6067,98 @@
|
||||
"rateLimit": "Too many attempts. Please wait before trying again."
|
||||
},
|
||||
"login": {
|
||||
"title": "Sign in",
|
||||
"subtitle": "Welcome back — log in to enter the hotel.",
|
||||
"subtitle2fa": "Enter the 6-digit code from your authenticator.",
|
||||
"welcomeBack": "Welcome back",
|
||||
"welcomeBackSub": "Sign in to continue to {hotelName}",
|
||||
"usernamePlaceholder": "Username",
|
||||
"passwordPlaceholder": "Password",
|
||||
"codePlaceholder": "2FA code",
|
||||
"pleaseWait": "Please wait…",
|
||||
"verify": "Verify",
|
||||
"signIn": "Sign in",
|
||||
"or": "or",
|
||||
"noAccount": "No account?",
|
||||
"createOne": "Create one",
|
||||
"forgotPassword": "Forgot password?",
|
||||
"errorInvalidCredentials": "Invalid username or password",
|
||||
"errorInvalid2fa": "Invalid 2FA code",
|
||||
"errorUnverified": "Please verify your email before signing in.",
|
||||
"errorCaptcha": "Captcha verification failed. Please try again.",
|
||||
"whoIsOnline": "Who's online",
|
||||
"newestCitizens": "Newest citizens",
|
||||
"usersOnline": "{count} online"
|
||||
"title": "تسجيل الدخول",
|
||||
"subtitle": "سجّل الدخول للمتابعة إلى الفندق التالي.",
|
||||
"subtitle2fa": "أدخل الرمز المكوّن من 6 أرقام من تطبيق المصادقة.",
|
||||
"welcomeBack": "أهلاً بعودتك",
|
||||
"welcomeBackSub": "سجّل الدخول للانضمام إلى {hotelName}",
|
||||
"usernamePlaceholder": "اسم المستخدم",
|
||||
"passwordPlaceholder": "كلمة المرور",
|
||||
"codePlaceholder": "أدخل رمز التحقق بخطوتين",
|
||||
"pleaseWait": "يرجى الانتظار...",
|
||||
"verify": "تحقق",
|
||||
"signIn": "تسجيل الدخول",
|
||||
"or": "أو",
|
||||
"noAccount": "ليس لديك حساب؟",
|
||||
"createOne": "أنشئ حساباً",
|
||||
"forgotPassword": "هل نسيت كلمة المرور؟",
|
||||
"errorInvalidCredentials": "اسم المستخدم أو كلمة المرور غير صحيحة",
|
||||
"errorInvalid2fa": "رمز التحقق بخطوتين غير صالح",
|
||||
"errorUnverified": "يرجى التحقق من بريدك الإلكتروني قبل تسجيل الدخول.",
|
||||
"errorCaptcha": "فشل التحقق من الكابتشا. حاول مرة أخرى.",
|
||||
"whoIsOnline": "من متصل الآن",
|
||||
"newestCitizens": "أحدث السكان",
|
||||
"usersOnline": "{count} متصل",
|
||||
"username": "اسم المستخدم",
|
||||
"password": "كلمة المرور",
|
||||
"showPassword": "إظهار",
|
||||
"hidePassword": "إخفاء"
|
||||
},
|
||||
"register": {
|
||||
"title": "Create account",
|
||||
"subtitle": "Join the hotel — it only takes a moment.",
|
||||
"username": "Username",
|
||||
"email": "Email",
|
||||
"password": "Password",
|
||||
"confirmPassword": "Repeat password",
|
||||
"usernamePlaceholder": "Username",
|
||||
"emailPlaceholder": "Email",
|
||||
"passwordPlaceholder": "Password (min 8 chars)",
|
||||
"confirmPasswordPlaceholder": "Repeat password",
|
||||
"selectOutfit": "Select your outfit",
|
||||
"termsAccept": "I am 18+ and accept the {hotel} terms & rules.",
|
||||
"accepted": "Accepted & agreed",
|
||||
"showPassword": "Show",
|
||||
"hidePassword": "Hide",
|
||||
"accountDetails": "Account details",
|
||||
"credentials": "Credentials & security",
|
||||
"createAccount": "Create account",
|
||||
"creatingAccount": "Creating account...",
|
||||
"redirecting": "Redirecting to your account...",
|
||||
"alreadyHaveAccount": "Already have an account? Login!",
|
||||
"alreadyHaveAccountPre": "Already have an account?",
|
||||
"alreadyHaveAccountLink": "Sign in",
|
||||
"register": "Register",
|
||||
"whoIsOnline": "Who's online",
|
||||
"usersOnline": "{count} online",
|
||||
"termsError": "You must accept the terms & rules to register.",
|
||||
"usernameError": "Username is required.",
|
||||
"emailError": "Valid email is required.",
|
||||
"passwordError": "Password must be at least 6 characters.",
|
||||
"confirmPasswordError": "Passwords do not match.",
|
||||
"termsRequired": "You must accept the terms & rules.",
|
||||
"usernameRequired": "Username is required.",
|
||||
"emailRequired": "Email is required.",
|
||||
"passwordRequired": "Password is required.",
|
||||
"passwordsDontMatch": "Passwords do not match.",
|
||||
"newestCitizens": "Newest citizens",
|
||||
"ageVerified": "أبلغ 18+ وأوافق على شرط العمر.",
|
||||
"invitedBy": "بدعوة من {username}"
|
||||
"title": "إنشاء حساب",
|
||||
"subtitle": "انضم إلى الفندق — لن يستغرق الأمر سوى لحظات.",
|
||||
"username": "اسم المستخدم",
|
||||
"email": "البريد الإلكتروني",
|
||||
"password": "كلمة المرور",
|
||||
"confirmPassword": "أعد كلمة المرور",
|
||||
"usernamePlaceholder": "اسم المستخدم",
|
||||
"emailPlaceholder": "البريد الإلكتروني",
|
||||
"passwordPlaceholder": "كلمة المرور (12 حرفًا على الأقل)",
|
||||
"confirmPasswordPlaceholder": "أعد كلمة المرور",
|
||||
"selectOutfit": "اختر ملابسك",
|
||||
"termsAccept": "أنا أبلغ 18 عامًا وأوافق على شروط {hotel}.",
|
||||
"accepted": "تم القبول والموافقة",
|
||||
"showPassword": "إظهار",
|
||||
"hidePassword": "إخفاء",
|
||||
"accountDetails": "بيانات الحساب",
|
||||
"credentials": "بيانات الدخول والأمان",
|
||||
"createAccount": "إنشاء حساب",
|
||||
"creatingAccount": "جارٍ إنشاء الحساب...",
|
||||
"redirecting": "جارٍ الانتقال إلى حسابك...",
|
||||
"alreadyHaveAccount": "لديك حساب بالفعل؟ سجّل الدخول!",
|
||||
"alreadyHaveAccountPre": "لديك حساب بالفعل؟",
|
||||
"alreadyHaveAccountLink": "تسجيل الدخول",
|
||||
"register": "تسجيل",
|
||||
"whoIsOnline": "من متصل الآن",
|
||||
"usersOnline": "{count} متصل",
|
||||
"termsError": "يجب الموافقة على الشروط للتسجيل.",
|
||||
"usernameError": "اسم المستخدم مطلوب.",
|
||||
"emailError": "البريد الإلكتروني الصالح مطلوب.",
|
||||
"passwordError": "يجب ألا تقل كلمة المرور عن 12 حرفًا",
|
||||
"confirmPasswordError": "كلمتا المرور غير متطابقتين.",
|
||||
"termsRequired": "يجب الموافقة على الشروط.",
|
||||
"usernameRequired": "اسم المستخدم مطلوب.",
|
||||
"emailRequired": "البريد الإلكتروني مطلوب.",
|
||||
"passwordRequired": "كلمة المرور مطلوبة.",
|
||||
"passwordsDontMatch": "كلمتا المرور غير متطابقتين.",
|
||||
"newestCitizens": "أحدث السكان",
|
||||
"ageVerified": "أنا أبلغ 18 عامًا وأوافق على شرط السن.",
|
||||
"invitedBy": "دعوة من {username}",
|
||||
"strengthWeak": "ضعيف",
|
||||
"strengthFair": "مقبول",
|
||||
"strengthGood": "جيد",
|
||||
"strengthStrong": "قوي",
|
||||
"passwordMinLength": "يجب ألا تقل كلمة المرور عن 12 حرفًا",
|
||||
"passwordUpper": "يجب أن تحتوي كلمة المرور على حرف كبير واحد على الأقل",
|
||||
"passwordLower": "يجب أن تحتوي كلمة المرور على حرف صغير واحد على الأقل",
|
||||
"passwordDigit": "يجب أن تحتوي كلمة المرور على رقم واحد على الأقل",
|
||||
"passwordSpecial": "يجب أن تحتوي كلمة المرور على رمز خاص واحد على الأقل",
|
||||
"passwordMaxLength": "كلمة المرور طويلة جدًا",
|
||||
"usernameMinLength": "يجب ألا يقل اسم المستخدم عن 3 أحرف",
|
||||
"usernameMaxLength": "يجب ألا يزيد اسم المستخدم عن 25 حرفًا",
|
||||
"usernamePattern": "لا يمكن أن يحتوي اسم المستخدم إلا على حروف وأرقام وشرطة سفلية وشرطة",
|
||||
"usernameReserved": "اسم المستخدم هذا محجوز",
|
||||
"emailValid": "أدخل بريدًا إلكترونيًا صالحًا",
|
||||
"emailDisposable": "نطاقات البريد المؤقتة غير مسموح بها",
|
||||
"passwordsMatch": "Passwords do not match.",
|
||||
"captchaFailed": "فشل التحقق من الكابتشا. حاول مرة أخرى.",
|
||||
"usernameTaken": "اسم المستخدم هذا مستخدم بالفعل",
|
||||
"rateLimited": "محاولات تسجيل كثيرة جدًا. انتظر بضع دقائق ثم حاول مرة أخرى.",
|
||||
"vpnBlocked": "التسجيل عبر اتصالات VPN أو البروكسي غير مسموح به.",
|
||||
"maxAccountsPerIp": "لقد بلغت الحد الأقصى من الحسابات لاتصالك.",
|
||||
"unavailable": "التسجيل غير متاح مؤقتًا.",
|
||||
"createFailed": "تعذر إنشاء الحساب. حاول مرة أخرى أو تواصل مع الإدارة.",
|
||||
"invalidInput": "يرجى مراجعة الحقول المميزة والمحاولة مرة أخرى."
|
||||
},
|
||||
"forgot": {
|
||||
"title": "Reset password",
|
||||
@@ -6143,9 +6172,11 @@
|
||||
"reset": {
|
||||
"title": "Set a new password",
|
||||
"subtitle": "Choose a strong password you don't use elsewhere.",
|
||||
"passwordPlaceholder": "New password (min 6 chars)",
|
||||
"passwordPlaceholder": "New password (min 12 chars)",
|
||||
"resetPassword": "Reset password",
|
||||
"backToLogin": "Back to login"
|
||||
"backToLogin": "Back to login",
|
||||
"passwordMinLength": "يجب ألا تقل كلمة المرور عن 12 حرفًا",
|
||||
"tooManyAttempts": "محاولات كثيرة جدًا — حاول لاحقًا"
|
||||
},
|
||||
"verify": {
|
||||
"verifiedTitle": "You're all set",
|
||||
|
||||
Reference in new issue
Block a user