fix 2fa and move communication language to setting
Build & Push / Pipeline Tests (push) Failing after 1m26s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 50s
Test / API Unit Tests (push) Failing after 1m6s
Test / Homepage Unit Tests (push) Successful in 48s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 41s
Test / API Integration Tests (push) Successful in 1m6s

This commit is contained in:
root
2026-08-23 00:45:39 -04:00
parent c8d7a3954a
commit e3f80af47d
29 changed files with 890 additions and 255 deletions
@@ -32,7 +32,8 @@ interface Dict {
verify: string;
verifying: string;
authCode: string;
enterCode: string;
enterEmailCode: string;
enterAuthenticatorCode: string;
totpPlaceholder: string;
back: string;
forgotPassword: string;
@@ -55,7 +56,8 @@ const dicts: Record<string, Dict> = {
verify: 'Verify code',
verifying: 'Verifying…',
authCode: 'Authentication code',
enterCode: 'Enter the 6-digit code sent to your admin email, or use your authenticator app.',
enterEmailCode: 'Enter the 6-digit code sent to your admin email.',
enterAuthenticatorCode: 'Enter the 6-digit code from your authenticator app.',
totpPlaceholder: '000000 or XXXX-XXXX-XXXX',
back: 'Back to credentials',
forgotPassword: 'Forgot your password?',
@@ -77,7 +79,8 @@ const dicts: Record<string, Dict> = {
verify: 'Vérifier le code',
verifying: 'Vérification…',
authCode: "Code d'authentification",
enterCode: 'Entrez le code à 6 chiffres envoyé à votre e-mail admin, ou utilisez votre application dauthentification.',
enterEmailCode: 'Entrez le code à 6 chiffres envoyé à votre e-mail admin.',
enterAuthenticatorCode: 'Entrez le code à 6 chiffres de votre application dauthentification.',
totpPlaceholder: '000000 ou XXXX-XXXX-XXXX',
back: 'Retour aux identifiants',
forgotPassword: 'Mot de passe oublié ?',
@@ -99,7 +102,8 @@ const dicts: Record<string, Dict> = {
verify: 'تحقق من الرمز',
verifying: 'جارٍ التحقق…',
authCode: 'رمز المصادقة',
enterCode: 'أدخل الرمز المكون من 6 أرقام المرسل إلى بريد المسؤول، أو استخدم تطبيق المصادقة.',
enterEmailCode: 'أدخل الرمز المكون من 6 أرقام المرسل إلى بريد المسؤول.',
enterAuthenticatorCode: 'أدخل الرمز المكون من 6 أرقام من تطبيق المصادقة.',
totpPlaceholder: '000000 أو XXXX-XXXX-XXXX',
back: 'العودة إلى بيانات الدخول',
forgotPassword: 'نسيت كلمة المرور؟',
@@ -126,6 +130,7 @@ export function SignInForm({
const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
const [totpCode, setTotpCode] = useState('');
const [secondFactorMethod, setSecondFactorMethod] = useState<'email' | 'authenticator'>('email');
const [step, setStep] = useState<'credentials' | 'totp'>('credentials');
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -170,7 +175,8 @@ export function SignInForm({
if (res.ok && completeLogin(json?.data)) return;
if (res.status === 401 && json?.error === 'totp_required') {
if (res.status === 401 && (json?.error === 'totp_required' || json?.error === 'two_factor_required')) {
setSecondFactorMethod(json?.method === 'authenticator' ? 'authenticator' : 'email');
setStep('totp');
return;
}
@@ -314,7 +320,7 @@ export function SignInForm({
className={styles.formStack}
>
<div className={styles.infoBox}>
{dict.enterCode}
{secondFactorMethod === 'authenticator' ? dict.enterAuthenticatorCode : dict.enterEmailCode}
</div>
<FormField id="signin-totp" label={dict.authCode} required>