From b978e09327deb08cfd49ebb21ae11d0a0fbd79c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sun, 23 Aug 2026 05:15:22 +0000 Subject: [PATCH] authentication and calendar-sync passwords keyed (214 -> 163) Authentication reaches zero -- sign-in, bootstrap, forgot and reset password. These are the first words a new account reads, which is why the brief ranked them above the larger screens. DavAppPasswords had the third toLocaleDateString(undefined, ...) in the shell; it now uses useFormat().date like the other two. DebugPanel's three labels are keyed too. Worth knowing rather than acting on: that panel is rendered behind showDebug, which Background.tsx hardcodes to false, so it never appears. Keyed rather than deleted because removing it is not my call. --- .../ForgotPassword/ForgotPassword.tsx | 16 +++--- .../ForgotPassword/ResetPassword.tsx | 22 +++---- .../ForgotPassword/useResetPassword.ts | 4 +- .../Authentication/LandingPage/Bootstrap.tsx | 26 +++++---- .../Authentication/LandingPage/Login.tsx | 16 +++--- .../Layout/DuckAvatar/DebugPanel.tsx | 9 ++- .../IntegrationsSettings/DavAppPasswords.tsx | 57 +++++++++++-------- src/apps/officer-web/locales/en-GB.json | 51 +++++++++++++++++ src/apps/officer-web/locales/pt-PT.json | 51 +++++++++++++++++ 9 files changed, 189 insertions(+), 63 deletions(-) diff --git a/src/apps/officer-web/Screens/Authentication/ForgotPassword/ForgotPassword.tsx b/src/apps/officer-web/Screens/Authentication/ForgotPassword/ForgotPassword.tsx index d7dc1d2e..f959e3e0 100644 --- a/src/apps/officer-web/Screens/Authentication/ForgotPassword/ForgotPassword.tsx +++ b/src/apps/officer-web/Screens/Authentication/ForgotPassword/ForgotPassword.tsx @@ -7,8 +7,10 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/Card'; +import { useTranslation } from '@/lib/i18n'; export function ForgotPassword() { + const { t } = useTranslation(); const client = useClient('/api/auth'); const [isSubmitting, setIsSubmitting] = useState(false); const [done, setDone] = useState(false); @@ -34,29 +36,29 @@ export function ForgotPassword() { {done ? (
-

Check your email

+

{t('auth.checkEmail')}

A password reset link has been sent to {state.email}.

-

Click it to reset your password.

+

{t('auth.checkEmailHint')}

) : ( <>
-
Forgot Password
-
Enter your email to receive a reset link
+
{t('auth.forgotTitle')}
+
{t('auth.forgotSubtitle')}
@@ -74,7 +76,7 @@ export function ForgotPassword() {

- Back to login + {t('auth.backToLogin')}

diff --git a/src/apps/officer-web/Screens/Authentication/ForgotPassword/ResetPassword.tsx b/src/apps/officer-web/Screens/Authentication/ForgotPassword/ResetPassword.tsx index c7a08e96..afc35975 100644 --- a/src/apps/officer-web/Screens/Authentication/ForgotPassword/ResetPassword.tsx +++ b/src/apps/officer-web/Screens/Authentication/ForgotPassword/ResetPassword.tsx @@ -4,8 +4,10 @@ import { Button } from '@/components/ui/button'; import { Card } from '@/components/Card'; import { cn } from '@/lib/utils'; import { useResetPassword } from './useResetPassword'; +import { useTranslation } from '@/lib/i18n'; export function ResetPassword() { + const { t } = useTranslation(); const { formRef, isValid, tokenStatus, isSubmitting, handleSubmit } = useResetPassword(); const loading = tokenStatus === 'loading'; const invalid = tokenStatus === 'invalid'; @@ -15,45 +17,45 @@ export function ResetPassword() { <> {loading && ( -
Verifying...
+
{t('auth.verifying')}
)} {invalid && (
-
Invalid Link
-
This reset link is invalid or has expired.
+
{t('auth.invalidLink')}
+
{t('auth.invalidLinkHint')}
)}
-
Reset Password
-
Enter your new password
+
{t('auth.resetTitle')}
+
{t('auth.resetSubtitle')}
@@ -65,7 +67,7 @@ export function ResetPassword() { disabled={!isValid || isSubmitting} className="w-full h-11 bg-duck-yellow hover:bg-duck-yellow/90 text-duck-teal font-bold text-lg transition-all duration-200 hover:scale-105 cursor-pointer disabled:opacity-50 disabled:hover:scale-100" > - {isSubmitting ? 'Resetting...' : 'Reset Password'} + {isSubmitting ? 'Resetting...' : t('auth.resetTitle')}
diff --git a/src/apps/officer-web/Screens/Authentication/ForgotPassword/useResetPassword.ts b/src/apps/officer-web/Screens/Authentication/ForgotPassword/useResetPassword.ts index 80944bc8..74572eef 100644 --- a/src/apps/officer-web/Screens/Authentication/ForgotPassword/useResetPassword.ts +++ b/src/apps/officer-web/Screens/Authentication/ForgotPassword/useResetPassword.ts @@ -4,8 +4,10 @@ import { toast } from 'sonner'; import { useMounted } from 'hooks/useMounted'; import { useForm } from 'hooks/useForm'; import { useClient } from 'hooks/useClient'; +import { useTranslation } from '@/lib/i18n'; export const useResetPassword = () => { + const { t } = useTranslation(); const isMounted = useMounted(); const navigate = useNavigate(); const client = useClient('/api/auth'); @@ -44,7 +46,7 @@ export const useResetPassword = () => { password: state.password, verificationCode, }); - toast.success('Password reset successfully. Please sign in.'); + toast.success(t('auth.resetOk')); navigate('/'); } catch (ex) { const error = ex as { message?: string }; diff --git a/src/apps/officer-web/Screens/Authentication/LandingPage/Bootstrap.tsx b/src/apps/officer-web/Screens/Authentication/LandingPage/Bootstrap.tsx index fe7f3594..1e6ed11a 100644 --- a/src/apps/officer-web/Screens/Authentication/LandingPage/Bootstrap.tsx +++ b/src/apps/officer-web/Screens/Authentication/LandingPage/Bootstrap.tsx @@ -7,8 +7,10 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card } from '@/components/Card'; import { useForm } from 'hooks/useForm'; +import { useTranslation } from '@/lib/i18n'; export function Bootstrap() { + const { t } = useTranslation(); const authClient = useClient('/api/auth'); const navigate = useNavigate(); const [isSubmitting, setIsSubmitting] = useState(false); @@ -30,7 +32,7 @@ export function Bootstrap() { password: state.password, confirmPassword: state.confirmPassword, }); - toast.success('Administrator account created. Please sign in.'); + toast.success(t('auth.bootstrapOk')); navigate('/'); } catch (ex) { const error = ex as { message?: string }; @@ -43,35 +45,35 @@ export function Bootstrap() { return (
-
Welcome, Admin
-
Create your administrator account
+
{t('auth.bootstrapTitle')}
+
{t('auth.bootstrapSubtitle')}