diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ab80268..cf8930b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -8,6 +8,10 @@ on: branches: [main] workflow_dispatch: +# Droits minimaux : le jeton du job ne peut que lire le dépôt (il ne sert qu'au clonage) +permissions: + contents: read + jobs: deploy: if: github.ref == 'refs/heads/main' diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..cffe8cd --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true diff --git a/CLAUDE.md b/CLAUDE.md index d0fa7de..0106fb9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,9 +61,11 @@ npm run build # build de prod - RTL géré (arabe) : préférer les classes logiques (`ps-`/`pe-`, `ms-`/`me-`, `start-`/`end-`, `border-e`). ## État (au 28 nov. 2026) -- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261128150000_feed_ratings.sql` incluse. +- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261128160000_mfa_enforcement.sql` incluse. - **Notifications : abonnements uniquement** (27 nov. 2026) — cloche sur l'accueil, dans l'app, pas de push. Types : `new_follower`, `follow_request`, `unfollow`, `follow_accepted` (trigger `follows_notify`, RPC `get_notifications` / `unread_notifications` / `mark_notifications_read`). Les anciennes notifications (push, commentaires, épisodes, invitations) et `azuu_notify` ont été supprimées. La fonction Edge `send-push` répond 410 : à supprimer depuis le tableau de bord Supabase. - **Retirés (27-28 nov. 2026)** : défis, couleur d'accent au choix, apparences Nuit/Étoilé, notation sur 10 (les notes restent stockées sur 10 en interne, affichées sur 5 étoiles). +- **Double authentification (TOTP)** : optionnelle, Réglages → Mon compte (`src/components/TwoFactor.tsx`, fonctions dans `src/lib/cloud/auth.ts`). À la connexion, `Root.tsx` demande le code (`MfaScreen`) si le compte a un facteur vérifié. Côté serveur, `azuu_mfa_ok()` : règles RLS restrictives « mfa required » (items, lists, settings, follows, profiles, activity), `is_admin()` et `azuu_me_active()` ; les fonctions Edge (`_shared/auth.ts`) refusent un jeton « aal1 » d'un compte protégé. +- **Dépendances figées** : versions exactes dans `package.json` + `.npmrc` (`save-exact=true`), CI en `npm ci`. - **Chargement** : les écrans rares (stats, réglages, admin, roulette, calendrier, écrans sociaux…) sont chargés à la demande puis préchargés au repos (`App.tsx` → `loaders`, `SocialProvider.tsx` → `socialLoaders`). - **Audit (22-24 nov. 2026)** : `20261122140000_audit_hardening.sql` versionne aussi les fonctions admin / « comptes suspendus » qui n'existaient qu'en ligne. Blocage = le compte bloquant devient invisible pour le bloqué ; fiches supprimées = `data` vidée (trigger `azuu_tombstone`) ; profils lisibles directement seulement par soi-même. - **Runner Gitea** : `kino` (étiquette `azuucine`), service `gitea-runner` dans le conteneur LXC `kino` du VPS. S'il est hors ligne, plus rien ne se déploie (voir `deploy/RUNNER.md`). diff --git a/package-lock.json b/package-lock.json index cc05e4b..a2328f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,20 +8,20 @@ "name": "azuucine", "version": "2.2.0", "dependencies": { - "@fontsource-variable/epilogue": "^5.3.0", - "lucide-react": "^0.468.0", - "react": "^19.1.0", - "react-dom": "^19.1.0" + "@fontsource-variable/epilogue": "5.3.0", + "lucide-react": "0.468.0", + "react": "19.3.0", + "react-dom": "19.3.0" }, "devDependencies": { - "@tailwindcss/vite": "^4.1.8", - "@types/react": "^19.1.6", - "@types/react-dom": "^19.1.5", - "@vitejs/plugin-react": "^4.5.0", - "tailwindcss": "^4.1.8", - "typescript": "^5.8.3", - "vite": "^6.4.3", - "vite-plugin-pwa": "^1.0.0" + "@tailwindcss/vite": "4.3.3", + "@types/react": "19.3.0", + "@types/react-dom": "19.3.0", + "@vitejs/plugin-react": "4.7.0", + "tailwindcss": "4.3.3", + "typescript": "5.9.3", + "vite": "6.4.6", + "vite-plugin-pwa": "1.3.0" } }, "node_modules/@apideck/better-ajv-errors": { @@ -3836,9 +3836,9 @@ "license": "MIT" }, "node_modules/fast-uri": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", - "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", "dev": true, "funding": [ { @@ -5654,9 +5654,9 @@ } }, "node_modules/serialize-javascript": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-7.1.2.tgz", - "integrity": "sha512-GL2BWwVa6JydKO6l/ljVgjAZF4QJ3S7dWDWi53s5GZT8PJzD2fNxi67HANQGKAqPrwEpL5ba7gUBGi0Ls/sEoQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-7.1.4.tgz", + "integrity": "sha512-FqlEuoTq/zRmA4Lg6aOqyH3lCHbUtCB0bmHCeFniX2GBdDqMJM3FwdvEhlE5Pim1dlt2FfBdVPmUNNiGhhKqpw==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -5845,13 +5845,13 @@ } }, "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz", + "integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==", "dev": true, "license": "BSD-3-Clause", "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, "node_modules/source-map-support": { @@ -6334,9 +6334,9 @@ } }, "node_modules/vite": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", - "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.6.tgz", + "integrity": "sha512-RtsraAwEG68idOA6iUOoIpOlcSKROnf815aIq9qHTSrDNpLoBrBa12suyfcEd8qn0xwOVQI1Yhm1GbmTjF600A==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 4e284d6..ee1eb3a 100644 --- a/package.json +++ b/package.json @@ -13,19 +13,19 @@ "audit": "npm audit --omit=dev" }, "dependencies": { - "@fontsource-variable/epilogue": "^5.3.0", - "lucide-react": "^0.468.0", - "react": "^19.1.0", - "react-dom": "^19.1.0" + "@fontsource-variable/epilogue": "5.3.0", + "lucide-react": "0.468.0", + "react": "19.3.0", + "react-dom": "19.3.0" }, "devDependencies": { - "@tailwindcss/vite": "^4.1.8", - "@types/react": "^19.1.6", - "@types/react-dom": "^19.1.5", - "@vitejs/plugin-react": "^4.5.0", - "tailwindcss": "^4.1.8", - "typescript": "^5.8.3", - "vite": "^6.4.3", - "vite-plugin-pwa": "^1.0.0" + "@tailwindcss/vite": "4.3.3", + "@types/react": "19.3.0", + "@types/react-dom": "19.3.0", + "@vitejs/plugin-react": "4.7.0", + "tailwindcss": "4.3.3", + "typescript": "5.9.3", + "vite": "6.4.6", + "vite-plugin-pwa": "1.3.0" } } diff --git a/src/Root.tsx b/src/Root.tsx index 16680c2..6652ee3 100644 --- a/src/Root.tsx +++ b/src/Root.tsx @@ -1,8 +1,8 @@ import { useEffect, useMemo, useState } from 'react' import App from './App' -import AuthScreen, { NewPasswordScreen } from './components/AuthScreen' +import AuthScreen, { MfaScreen, NewPasswordScreen } from './components/AuthScreen' import GuestPrompt, { GuestBanner } from './components/guest/GuestPrompt' -import { consumeAuthRedirect, getSession, hasOAuthRedirect, onSessionChange, type Session } from './lib/cloud/auth' +import { consumeAuthRedirect, getSession, hasOAuthRedirect, knownMfa, onSessionChange, pendingMfaFactor, sessionAal, type Session } from './lib/cloud/auth' import { cloudEnabled } from './lib/cloud/config' import { setScope } from './lib/scope' import { MediaProvider } from './store' @@ -46,6 +46,28 @@ export default function Root() { setAuthMode(mode) setGuest(false) } + // Double authentification : un compte protégé doit saisir son code avant d'entrer (undefined = vérification en cours). + // Comptes sans double authentification (déjà vérifiés sur cet appareil) : on entre tout de suite, la vérification se fait en fond. + const [mfaFactor, setMfaFactor] = useState(() => + cloudEnabled && getSession() && sessionAal() !== 'aal2' && knownMfa() !== false ? undefined : null, + ) + const accessToken = session?.accessToken + useEffect(() => { + if (!cloudEnabled || !accessToken || sessionAal() === 'aal2' || !navigator.onLine) { + setMfaFactor(null) + return + } + let alive = true + // Nouvelle connexion d'un compte peut-être protégé : on attend la vérification avant d'ouvrir l'app + if (knownMfa() !== false) setMfaFactor(undefined) + pendingMfaFactor() + .then((f) => alive && setMfaFactor(f)) + // Serveur injoignable : on laisse entrer (la base refuse de toute façon les données sans le code) + .catch(() => alive && setMfaFactor(null)) + return () => { + alive = false + } + }, [accessToken]) const userId = session?.user.id const userEmail = session?.user.email const user = useMemo(() => (userId ? { id: userId, email: userEmail ?? '' } : undefined), [userId, userEmail]) @@ -105,6 +127,9 @@ export default function Root() { ) } + if (mfaFactor === undefined) return
+ if (mfaFactor) return + // L'espace de stockage doit être choisi avant que le fournisseur de données ne lise quoi que ce soit setScope(session.user.id) return ( diff --git a/src/components/AccountSection.tsx b/src/components/AccountSection.tsx index bec0ab5..21203fa 100644 --- a/src/components/AccountSection.tsx +++ b/src/components/AccountSection.tsx @@ -7,6 +7,7 @@ import { PASSWORD_MIN, updatePassword } from '../lib/cloud/auth' import type { AccountApi } from '../store' import ConfirmDialog from './ConfirmDialog' import { SectionTitle } from './ui' +import TwoFactor from './TwoFactor' /** Réglages → Mon compte : mot de passe, déconnexion. La synchro tourne en arrière-plan. */ export default function AccountSection({ account, onMessage }: { account: AccountApi; onMessage: (kind: 'ok' | 'error', text: string) => void }) { @@ -113,6 +114,8 @@ export default function AccountSection({ account, onMessage }: { account: Accoun )} + + + + + + ) +} + /** Liens vers les pages légales (statiques, hors de l'app). */ export function LegalLinks() { return ( diff --git a/src/components/TwoFactor.tsx b/src/components/TwoFactor.tsx new file mode 100644 index 0000000..595f85e --- /dev/null +++ b/src/components/TwoFactor.tsx @@ -0,0 +1,109 @@ +import { Loader2, ShieldCheck } from 'lucide-react' +import { useEffect, useState, type FormEvent } from 'react' +import { t } from '../i18n' +import { enrollTotp, listTotpFactors, removeTotp, verifyTotp } from '../lib/cloud/auth' +import { TotpField } from './AuthScreen' + +/** Réglages → Mon compte : activer / désactiver la double authentification (application d'authentification). */ +export default function TwoFactor({ onMessage }: { onMessage: (kind: 'ok' | 'error', text: string) => void }) { + // undefined : chargement ; null : pas activée ; sinon l'identifiant du facteur + const [factor, setFactor] = useState() + const [setup, setSetup] = useState<{ id: string; qr: string; secret: string }>() + const [code, setCode] = useState('') + const [busy, setBusy] = useState(false) + + useEffect(() => { + let alive = true + listTotpFactors() + .then((f) => alive && setFactor(f.find((x) => x.verified)?.id ?? null)) + .catch(() => alive && setFactor(null)) + return () => { + alive = false + } + }, []) + + const start = async () => { + setBusy(true) + try { + setSetup(await enrollTotp()) + setCode('') + } catch (e) { + onMessage('error', (e as Error).message) + } finally { + setBusy(false) + } + } + + const confirm = async (e: FormEvent) => { + e.preventDefault() + if (!setup || busy) return + setBusy(true) + try { + await verifyTotp(setup.id, code) + setFactor(setup.id) + setSetup(undefined) + onMessage('ok', t('mfa.enabled')) + } catch (err) { + onMessage('error', (err as Error).message) + setCode('') + } finally { + setBusy(false) + } + } + + const disable = async () => { + if (!factor) return + setBusy(true) + try { + await removeTotp(factor) + setFactor(null) + onMessage('ok', t('mfa.disabled')) + } catch (e) { + onMessage('error', (e as Error).message) + } finally { + setBusy(false) + } + } + + return ( +
+
+ + + {t('mfa.title')} + {factor === undefined ? '…' : factor ? t('mfa.on') : t('mfa.off')} + + {factor !== undefined && !setup && ( + + )} +
+ + {setup && ( +
+

{t('mfa.scan')}

+ {setup.qr && ( +
+ +
+ )} +

+ {t('mfa.secret')} {setup.secret} +

+ +
+ + +
+ + )} +
+ ) +} diff --git a/src/components/guest/GuestPrompt.tsx b/src/components/guest/GuestPrompt.tsx index 8000c55..c5591c6 100644 --- a/src/components/guest/GuestPrompt.tsx +++ b/src/components/guest/GuestPrompt.tsx @@ -20,7 +20,7 @@ export default function GuestPrompt({ onSignIn, onSignUp, onClose }: { onSignIn:

- Kino + Bobinoo

{t('guest.promptTitle')} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 8f88af4..f6f6518 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -195,7 +195,6 @@ const dict: Translations = { 'auth.newPassword': 'كلمة المرور الجديدة', 'auth.err.credentials': 'البريد الإلكتروني أو كلمة المرور غير صحيحة.', 'auth.err.notConfirmed': 'أكّد عنوانك أولًا عبر الرابط الذي وصلك بالبريد الإلكتروني.', - 'auth.err.exists': 'يوجد حساب بهذا البريد الإلكتروني بالفعل.', 'auth.err.weak': 'كلمة المرور ضعيفة جدًا ({n} أحرف على الأقل، مزيج من الحروف والأرقام).', 'auth.err.pwned': "ظهرت كلمة المرور هذه في تسريب بيانات معروف — اختر كلمة أخرى.", 'auth.err.samePassword': 'يجب أن تختلف كلمة المرور الجديدة عن القديمة.', @@ -369,6 +368,19 @@ const dict: Translations = { 'account.importFailed': 'فشل الاستيراد.', 'account.newPasswordPh': 'كلمة مرور جديدة ({n} أحرف على الأقل)', 'account.changePassword': 'تغيير كلمة المرور', + 'mfa.title': "المصادقة الثنائية", + 'mfa.on': "مفعّلة", + 'mfa.off': "غير مفعّلة", + 'mfa.enable': "تفعيل", + 'mfa.disable': "إيقاف", + 'mfa.scan': "امسح رمز QR هذا بتطبيق المصادقة (Google Authenticator أو Authy…) ثم أدخل الرمز المكوّن من 6 أرقام.", + 'mfa.secret': "أو أدخل هذا المفتاح:", + 'mfa.code': "رمز من 6 أرقام", + 'mfa.confirm': "تأكيد", + 'mfa.enabled': "تم تفعيل المصادقة الثنائية.", + 'mfa.disabled': "تم إيقاف المصادقة الثنائية.", + 'mfa.loginText': "افتح تطبيق المصادقة وأدخل الرمز المكوّن من 6 أرقام.", + 'mfa.err.code': "رمز غير صحيح أو منتهي الصلاحية.", 'account.logout': 'تسجيل الخروج', 'account.logoutHint': 'تبقى بياناتك في حسابك وتُزال من هذا الجهاز.', 'account.ignore': 'تجاهل', diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 525a537..4ed3b81 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Neues Passwort', 'auth.err.credentials': 'E-Mail oder Passwort falsch.', 'auth.err.notConfirmed': 'Bestätige zuerst deine Adresse über den Link in der E-Mail.', - 'auth.err.exists': 'Mit dieser E-Mail gibt es schon ein Konto.', 'auth.err.weak': 'Passwort zu schwach (mindestens {n} Zeichen, Buchstaben und Zahlen gemischt).', 'auth.err.pwned': "Dieses Passwort ist in einem bekannten Datenleck aufgetaucht – bitte wähle ein anderes.", 'auth.err.samePassword': 'Das neue Passwort muss sich vom alten unterscheiden.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'Import fehlgeschlagen.', 'account.newPasswordPh': 'Neues Passwort (min. {n} Zeichen)', 'account.changePassword': 'Passwort ändern', + 'mfa.title': "Zwei-Faktor-Authentifizierung", + 'mfa.on': "Aktiv", + 'mfa.off': "Inaktiv", + 'mfa.enable': "Aktivieren", + 'mfa.disable': "Deaktivieren", + 'mfa.scan': "Scanne diesen QR-Code mit deiner Authenticator-App (Google Authenticator, Authy…) und gib den angezeigten 6-stelligen Code ein.", + 'mfa.secret': "Oder gib diesen Schlüssel ein:", + 'mfa.code': "6-stelliger Code", + 'mfa.confirm': "Bestätigen", + 'mfa.enabled': "Zwei-Faktor-Authentifizierung aktiviert.", + 'mfa.disabled': "Zwei-Faktor-Authentifizierung deaktiviert.", + 'mfa.loginText': "Öffne deine Authenticator-App und gib den 6-stelligen Code ein.", + 'mfa.err.code': "Falscher oder abgelaufener Code.", 'account.logout': 'Abmelden', 'account.logoutHint': 'Deine Daten bleiben in deinem Konto und werden von diesem Gerät entfernt.', 'account.ignore': 'Ignorieren', diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 272258b..7e8a852 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'New password', 'auth.err.credentials': 'Wrong email or password.', 'auth.err.notConfirmed': 'Confirm your address first with the link we emailed you.', - 'auth.err.exists': 'An account already exists with this email.', 'auth.err.weak': 'Password too weak (at least {n} characters, mix letters and numbers).', 'auth.err.pwned': "This password has appeared in a known data breach — please choose another one.", 'auth.err.samePassword': 'Your new password must be different from the old one.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'Import failed.', 'account.newPasswordPh': 'New password ({n} characters min.)', 'account.changePassword': 'Change password', + 'mfa.title': "Two-factor authentication", + 'mfa.on': "On", + 'mfa.off': "Off", + 'mfa.enable': "Turn on", + 'mfa.disable': "Turn off", + 'mfa.scan': "Scan this QR code with your authenticator app (Google Authenticator, Authy…), then enter the 6-digit code it shows.", + 'mfa.secret': "Or enter this key:", + 'mfa.code': "6-digit code", + 'mfa.confirm': "Confirm", + 'mfa.enabled': "Two-factor authentication is on.", + 'mfa.disabled': "Two-factor authentication is off.", + 'mfa.loginText': "Open your authenticator app and enter the 6-digit code.", + 'mfa.err.code': "Wrong or expired code.", 'account.logout': 'Log out', 'account.logoutHint': 'Your data stays in your account and is removed from this device.', 'account.ignore': 'Ignore', diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index a7359db..4c7adf7 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Nueva contraseña', 'auth.err.credentials': 'Correo o contraseña incorrectos.', 'auth.err.notConfirmed': 'Primero confirma tu dirección con el enlace que recibiste por correo.', - 'auth.err.exists': 'Ya existe una cuenta con este correo.', 'auth.err.weak': 'Contraseña demasiado débil (al menos {n} caracteres, mezcla letras y números).', 'auth.err.pwned': "Esta contraseña apareció en una filtración de datos conocida: elige otra.", 'auth.err.samePassword': 'La nueva contraseña tiene que ser distinta de la anterior.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'La importación falló.', 'account.newPasswordPh': 'Nueva contraseña (mín. {n} caracteres)', 'account.changePassword': 'Cambiar la contraseña', + 'mfa.title': "Verificación en dos pasos", + 'mfa.on': "Activada", + 'mfa.off': "Desactivada", + 'mfa.enable': "Activar", + 'mfa.disable': "Desactivar", + 'mfa.scan': "Escanea este código QR con tu app de autenticación (Google Authenticator, Authy…) e introduce el código de 6 cifras que muestra.", + 'mfa.secret': "O introduce esta clave:", + 'mfa.code': "Código de 6 cifras", + 'mfa.confirm': "Confirmar", + 'mfa.enabled': "Verificación en dos pasos activada.", + 'mfa.disabled': "Verificación en dos pasos desactivada.", + 'mfa.loginText': "Abre tu app de autenticación e introduce el código de 6 cifras.", + 'mfa.err.code': "Código incorrecto o caducado.", 'account.logout': 'Cerrar sesión', 'account.logoutHint': 'Tus datos se quedan en tu cuenta y se quitan de este dispositivo.', 'account.ignore': 'Ignorar', diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 79717a8..88badea 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -194,7 +194,6 @@ const dict = { 'auth.newPassword': 'Nouveau mot de passe', 'auth.err.credentials': 'Email ou mot de passe incorrect.', 'auth.err.notConfirmed': 'Confirme d\'abord ton adresse avec le lien reçu par email.', - 'auth.err.exists': 'Un compte existe déjà avec cet email.', 'auth.err.weak': 'Mot de passe trop faible (au moins {n} caractères, mélange lettres et chiffres).', 'auth.err.pwned': "Ce mot de passe est apparu dans une fuite de données connue : choisis-en un autre.", 'auth.err.samePassword': 'Le nouveau mot de passe doit être différent de l\'ancien.', @@ -344,6 +343,19 @@ const dict = { 'account.importFailed': 'L\'import a échoué.', 'account.newPasswordPh': 'Nouveau mot de passe ({n} caractères min.)', 'account.changePassword': 'Changer le mot de passe', + 'mfa.title': "Double authentification", + 'mfa.on': "Activée", + 'mfa.off': "Désactivée", + 'mfa.enable': "Activer", + 'mfa.disable': "Désactiver", + 'mfa.scan': "Scanne ce QR code avec ton application d'authentification (Google Authenticator, Authy…), puis saisis le code à 6 chiffres qu'elle affiche.", + 'mfa.secret': "Ou saisis cette clé :", + 'mfa.code': "Code à 6 chiffres", + 'mfa.confirm': "Valider", + 'mfa.enabled': "Double authentification activée.", + 'mfa.disabled': "Double authentification désactivée.", + 'mfa.loginText': "Ouvre ton application d'authentification et saisis le code à 6 chiffres.", + 'mfa.err.code': "Code incorrect ou expiré.", 'account.logout': 'Se déconnecter', 'account.logoutHint': 'Tes données restent dans ton compte et sont retirées de cet appareil.', 'account.ignore': 'Ignorer', diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 7763f8c..ccb4331 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'नया पासवर्ड', 'auth.err.credentials': 'ईमेल या पासवर्ड गलत है।', 'auth.err.notConfirmed': 'पहले ईमेल में मिले लिंक से अपना पता कन्फ़र्म करें।', - 'auth.err.exists': 'इस ईमेल से पहले से एक अकाउंट मौजूद है।', 'auth.err.weak': 'पासवर्ड बहुत कमज़ोर है (कम से कम {n} कैरेक्टर, अक्षर और अंक मिलाकर)।', 'auth.err.pwned': "यह पासवर्ड किसी ज्ञात डेटा लीक में सामने आ चुका है — कृपया कोई दूसरा चुनें।", 'auth.err.samePassword': 'नया पासवर्ड पुराने से अलग होना चाहिए।', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'इम्पोर्ट नहीं हो सका।', 'account.newPasswordPh': 'नया पासवर्ड (कम से कम {n} कैरेक्टर)', 'account.changePassword': 'पासवर्ड बदलें', + 'mfa.title': "दो-चरणीय सत्यापन", + 'mfa.on': "चालू", + 'mfa.off': "बंद", + 'mfa.enable': "चालू करें", + 'mfa.disable': "बंद करें", + 'mfa.scan': "इस QR कोड को अपने ऑथेंटिकेटर ऐप (Google Authenticator, Authy…) से स्कैन करें, फिर दिखाया गया 6 अंकों का कोड डालें।", + 'mfa.secret': "या यह कुंजी डालें:", + 'mfa.code': "6 अंकों का कोड", + 'mfa.confirm': "पुष्टि करें", + 'mfa.enabled': "दो-चरणीय सत्यापन चालू हो गया।", + 'mfa.disabled': "दो-चरणीय सत्यापन बंद हो गया।", + 'mfa.loginText': "अपना ऑथेंटिकेटर ऐप खोलें और 6 अंकों का कोड डालें।", + 'mfa.err.code': "कोड गलत है या उसकी अवधि खत्म हो गई।", 'account.logout': 'लॉग आउट', 'account.logoutHint': 'आपका डेटा आपके अकाउंट में रहेगा और इस डिवाइस से हटा दिया जाएगा।', 'account.ignore': 'नज़रअंदाज़ करें', diff --git a/src/i18n/locales/id.ts b/src/i18n/locales/id.ts index 454dff3..423ae04 100644 --- a/src/i18n/locales/id.ts +++ b/src/i18n/locales/id.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Kata sandi baru', 'auth.err.credentials': 'Email atau kata sandi salah.', 'auth.err.notConfirmed': 'Konfirmasi dulu alamatmu lewat tautan yang dikirim ke email.', - 'auth.err.exists': 'Sudah ada akun dengan email ini.', 'auth.err.weak': 'Kata sandi terlalu lemah (minimal {n} karakter, campur huruf dan angka).', 'auth.err.pwned': "Kata sandi ini pernah muncul dalam kebocoran data yang diketahui — pilih yang lain.", 'auth.err.samePassword': 'Kata sandi baru harus beda dari yang lama.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'Impor gagal.', 'account.newPasswordPh': 'Kata sandi baru (min. {n} karakter)', 'account.changePassword': 'Ganti kata sandi', + 'mfa.title': "Autentikasi dua faktor", + 'mfa.on': "Aktif", + 'mfa.off': "Nonaktif", + 'mfa.enable': "Aktifkan", + 'mfa.disable': "Nonaktifkan", + 'mfa.scan': "Pindai kode QR ini dengan aplikasi autentikator (Google Authenticator, Authy…), lalu masukkan kode 6 digit yang muncul.", + 'mfa.secret': "Atau masukkan kunci ini:", + 'mfa.code': "Kode 6 digit", + 'mfa.confirm': "Konfirmasi", + 'mfa.enabled': "Autentikasi dua faktor diaktifkan.", + 'mfa.disabled': "Autentikasi dua faktor dinonaktifkan.", + 'mfa.loginText': "Buka aplikasi autentikator dan masukkan kode 6 digit.", + 'mfa.err.code': "Kode salah atau kedaluwarsa.", 'account.logout': 'Keluar', 'account.logoutHint': 'Datamu tetap ada di akunmu dan dihapus dari perangkat ini.', 'account.ignore': 'Abaikan', diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index 527acf5..3b3f0df 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Nuova password', 'auth.err.credentials': 'Email o password errata.', 'auth.err.notConfirmed': 'Prima conferma il tuo indirizzo con il link ricevuto via email.', - 'auth.err.exists': 'Esiste già un account con questa email.', 'auth.err.weak': 'Password troppo debole (almeno {n} caratteri, mescola lettere e numeri).', 'auth.err.pwned': "Questa password è comparsa in una fuga di dati nota: scegline un'altra.", 'auth.err.samePassword': 'La nuova password deve essere diversa da quella vecchia.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'L’importazione non è riuscita.', 'account.newPasswordPh': 'Nuova password (min. {n} caratteri)', 'account.changePassword': 'Cambia la password', + 'mfa.title': "Autenticazione a due fattori", + 'mfa.on': "Attiva", + 'mfa.off': "Disattivata", + 'mfa.enable': "Attiva", + 'mfa.disable': "Disattiva", + 'mfa.scan': "Scansiona questo codice QR con la tua app di autenticazione (Google Authenticator, Authy…) e inserisci il codice a 6 cifre mostrato.", + 'mfa.secret': "Oppure inserisci questa chiave:", + 'mfa.code': "Codice a 6 cifre", + 'mfa.confirm': "Conferma", + 'mfa.enabled': "Autenticazione a due fattori attivata.", + 'mfa.disabled': "Autenticazione a due fattori disattivata.", + 'mfa.loginText': "Apri la tua app di autenticazione e inserisci il codice a 6 cifre.", + 'mfa.err.code': "Codice errato o scaduto.", 'account.logout': 'Esci', 'account.logoutHint': 'I tuoi dati restano nel tuo account e vengono rimossi da questo dispositivo.', 'account.ignore': 'Ignora', diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 95bb127..ad7cb2c 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': '新しいパスワード', 'auth.err.credentials': 'メールアドレスまたはパスワードが違います。', 'auth.err.notConfirmed': '先にメールで届いたリンクからアドレスを確認してください。', - 'auth.err.exists': 'このメールアドレスのアカウントはすでに存在します。', 'auth.err.weak': 'パスワードが弱すぎます({n}文字以上、英字と数字を組み合わせてください)。', 'auth.err.pwned': "このパスワードは既知のデータ漏えいで見つかっています。別のパスワードを選んでください。", 'auth.err.samePassword': '新しいパスワードは以前のものと違うものにしてください。', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'インポートに失敗しました。', 'account.newPasswordPh': '新しいパスワード({n}文字以上)', 'account.changePassword': 'パスワードを変更', + 'mfa.title': "2段階認証", + 'mfa.on': "オン", + 'mfa.off': "オフ", + 'mfa.enable': "オンにする", + 'mfa.disable': "オフにする", + 'mfa.scan': "認証アプリ(Google Authenticator、Authy など)でこのQRコードを読み取り、表示された6桁のコードを入力してください。", + 'mfa.secret': "またはこのキーを入力:", + 'mfa.code': "6桁のコード", + 'mfa.confirm': "確認", + 'mfa.enabled': "2段階認証をオンにしました。", + 'mfa.disabled': "2段階認証をオフにしました。", + 'mfa.loginText': "認証アプリを開いて6桁のコードを入力してください。", + 'mfa.err.code': "コードが正しくないか期限切れです。", 'account.logout': 'ログアウト', 'account.logoutHint': 'データはアカウントに残り、この端末からは削除されます。', 'account.ignore': '無視', diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 0ec8e44..dddd4b4 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': '새 비밀번호', 'auth.err.credentials': '이메일 또는 비밀번호가 올바르지 않아요.', 'auth.err.notConfirmed': '먼저 이메일로 받은 링크로 주소를 인증해 주세요.', - 'auth.err.exists': '이미 이 이메일로 가입된 계정이 있어요.', 'auth.err.weak': '비밀번호가 너무 약해요 ({n}자 이상, 영문과 숫자를 섞어 주세요).', 'auth.err.pwned': "이 비밀번호는 알려진 데이터 유출에서 발견됐어요. 다른 비밀번호를 선택해 주세요.", 'auth.err.samePassword': '새 비밀번호는 이전 비밀번호와 달라야 해요.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': '가져오기에 실패했어요.', 'account.newPasswordPh': '새 비밀번호 (최소 {n}자)', 'account.changePassword': '비밀번호 변경', + 'mfa.title': "2단계 인증", + 'mfa.on': "켜짐", + 'mfa.off': "꺼짐", + 'mfa.enable': "켜기", + 'mfa.disable': "끄기", + 'mfa.scan': "인증 앱(Google Authenticator, Authy 등)으로 이 QR 코드를 스캔한 뒤 표시된 6자리 코드를 입력하세요.", + 'mfa.secret': "또는 이 키를 입력하세요:", + 'mfa.code': "6자리 코드", + 'mfa.confirm': "확인", + 'mfa.enabled': "2단계 인증이 켜졌어요.", + 'mfa.disabled': "2단계 인증이 꺼졌어요.", + 'mfa.loginText': "인증 앱을 열고 6자리 코드를 입력하세요.", + 'mfa.err.code': "코드가 틀렸거나 만료됐어요.", 'account.logout': '로그아웃', 'account.logoutHint': '데이터는 계정에 그대로 남고 이 기기에서만 지워져요.', 'account.ignore': '무시', diff --git a/src/i18n/locales/nl.ts b/src/i18n/locales/nl.ts index 520d180..8ce4fd3 100644 --- a/src/i18n/locales/nl.ts +++ b/src/i18n/locales/nl.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Nieuw wachtwoord', 'auth.err.credentials': 'Onjuist e-mailadres of wachtwoord.', 'auth.err.notConfirmed': 'Bevestig eerst je adres via de link in je e-mail.', - 'auth.err.exists': 'Er bestaat al een account met dit e-mailadres.', 'auth.err.weak': 'Wachtwoord te zwak (minstens {n} tekens, mix van letters en cijfers).', 'auth.err.pwned': "Dit wachtwoord is uitgelekt bij een bekend datalek — kies een ander.", 'auth.err.samePassword': 'Je nieuwe wachtwoord moet anders zijn dan het oude.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'Importeren mislukt.', 'account.newPasswordPh': 'Nieuw wachtwoord (min. {n} tekens)', 'account.changePassword': 'Wachtwoord wijzigen', + 'mfa.title': "Tweestapsverificatie", + 'mfa.on': "Aan", + 'mfa.off': "Uit", + 'mfa.enable': "Inschakelen", + 'mfa.disable': "Uitschakelen", + 'mfa.scan': "Scan deze QR-code met je authenticator-app (Google Authenticator, Authy…) en voer de getoonde 6-cijferige code in.", + 'mfa.secret': "Of voer deze sleutel in:", + 'mfa.code': "6-cijferige code", + 'mfa.confirm': "Bevestigen", + 'mfa.enabled': "Tweestapsverificatie ingeschakeld.", + 'mfa.disabled': "Tweestapsverificatie uitgeschakeld.", + 'mfa.loginText': "Open je authenticator-app en voer de 6-cijferige code in.", + 'mfa.err.code': "Onjuiste of verlopen code.", 'account.logout': 'Uitloggen', 'account.logoutHint': 'Je gegevens blijven in je account en worden van dit apparaat verwijderd.', 'account.ignore': 'Negeren', diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index b124d85..619c896 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -194,7 +194,6 @@ const dict: Translations = { 'auth.newPassword': 'Nowe hasło', 'auth.err.credentials': 'Nieprawidłowy e-mail lub hasło.', 'auth.err.notConfirmed': 'Najpierw potwierdź swój adres linkiem z e-maila.', - 'auth.err.exists': 'Konto z tym adresem e-mail już istnieje.', 'auth.err.weak': 'Hasło jest za słabe (co najmniej {n} znaków, litery i cyfry).', 'auth.err.pwned': "To hasło pojawiło się w znanym wycieku danych — wybierz inne.", 'auth.err.samePassword': 'Nowe hasło musi być inne niż poprzednie.', @@ -360,6 +359,19 @@ const dict: Translations = { 'account.importFailed': 'Import nie powiódł się.', 'account.newPasswordPh': 'Nowe hasło (min. {n} znaków)', 'account.changePassword': 'Zmień hasło', + 'mfa.title': "Weryfikacja dwuetapowa", + 'mfa.on': "Włączona", + 'mfa.off': "Wyłączona", + 'mfa.enable': "Włącz", + 'mfa.disable': "Wyłącz", + 'mfa.scan': "Zeskanuj ten kod QR aplikacją uwierzytelniającą (Google Authenticator, Authy…) i wpisz wyświetlony 6-cyfrowy kod.", + 'mfa.secret': "Lub wpisz ten klucz:", + 'mfa.code': "Kod 6-cyfrowy", + 'mfa.confirm': "Potwierdź", + 'mfa.enabled': "Weryfikacja dwuetapowa włączona.", + 'mfa.disabled': "Weryfikacja dwuetapowa wyłączona.", + 'mfa.loginText': "Otwórz aplikację uwierzytelniającą i wpisz 6-cyfrowy kod.", + 'mfa.err.code': "Nieprawidłowy lub wygasły kod.", 'account.logout': 'Wyloguj się', 'account.logoutHint': 'Twoje dane zostają na koncie i zostaną usunięte z tego urządzenia.', 'account.ignore': 'Pomiń', diff --git a/src/i18n/locales/pt.ts b/src/i18n/locales/pt.ts index aa0463d..6f267dd 100644 --- a/src/i18n/locales/pt.ts +++ b/src/i18n/locales/pt.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Nova senha', 'auth.err.credentials': 'E-mail ou senha incorretos.', 'auth.err.notConfirmed': 'Primeiro confirme seu endereço com o link que você recebeu por e-mail.', - 'auth.err.exists': 'Já existe uma conta com esse e-mail.', 'auth.err.weak': 'Senha muito fraca (pelo menos {n} caracteres, misturando letras e números).', 'auth.err.pwned': "Esta palavra-passe apareceu numa fuga de dados conhecida: escolhe outra.", 'auth.err.samePassword': 'A nova senha precisa ser diferente da antiga.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'A importação falhou.', 'account.newPasswordPh': 'Nova senha (mín. {n} caracteres)', 'account.changePassword': 'Alterar a senha', + 'mfa.title': "Autenticação de dois fatores", + 'mfa.on': "Ativada", + 'mfa.off': "Desativada", + 'mfa.enable': "Ativar", + 'mfa.disable': "Desativar", + 'mfa.scan': "Lê este código QR com a tua app de autenticação (Google Authenticator, Authy…) e introduz o código de 6 dígitos que aparece.", + 'mfa.secret': "Ou introduz esta chave:", + 'mfa.code': "Código de 6 dígitos", + 'mfa.confirm': "Confirmar", + 'mfa.enabled': "Autenticação de dois fatores ativada.", + 'mfa.disabled': "Autenticação de dois fatores desativada.", + 'mfa.loginText': "Abre a tua app de autenticação e introduz o código de 6 dígitos.", + 'mfa.err.code': "Código incorreto ou expirado.", 'account.logout': 'Sair', 'account.logoutHint': 'Seus dados continuam na sua conta e são removidos deste aparelho.', 'account.ignore': 'Ignorar', diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 554bf5c..a41f476 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -194,7 +194,6 @@ const dict: Translations = { 'auth.newPassword': 'Новый пароль', 'auth.err.credentials': 'Неверная почта или пароль.', 'auth.err.notConfirmed': 'Сначала подтверди адрес по ссылке из письма.', - 'auth.err.exists': 'Аккаунт с этой почтой уже существует.', 'auth.err.weak': 'Слишком простой пароль (минимум {n} символов, буквы и цифры).', 'auth.err.pwned': "Этот пароль встречался в известной утечке данных — выбери другой.", 'auth.err.samePassword': 'Новый пароль должен отличаться от старого.', @@ -360,6 +359,19 @@ const dict: Translations = { 'account.importFailed': 'Не удалось импортировать.', 'account.newPasswordPh': 'Новый пароль (мин. {n} символов)', 'account.changePassword': 'Сменить пароль', + 'mfa.title': "Двухфакторная аутентификация", + 'mfa.on': "Включена", + 'mfa.off': "Выключена", + 'mfa.enable': "Включить", + 'mfa.disable': "Выключить", + 'mfa.scan': "Отсканируй этот QR-код приложением-аутентификатором (Google Authenticator, Authy…) и введи показанный 6-значный код.", + 'mfa.secret': "Или введи этот ключ:", + 'mfa.code': "6-значный код", + 'mfa.confirm': "Подтвердить", + 'mfa.enabled': "Двухфакторная аутентификация включена.", + 'mfa.disabled': "Двухфакторная аутентификация выключена.", + 'mfa.loginText': "Открой приложение-аутентификатор и введи 6-значный код.", + 'mfa.err.code': "Неверный или устаревший код.", 'account.logout': 'Выйти', 'account.logoutHint': 'Данные останутся в аккаунте и будут удалены с этого устройства.', 'account.ignore': 'Пропустить', diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index a54188b..63e5c76 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'รหัสผ่านใหม่', 'auth.err.credentials': 'อีเมลหรือรหัสผ่านไม่ถูกต้อง', 'auth.err.notConfirmed': 'ยืนยันอีเมลของคุณก่อนด้วยลิงก์ที่เราส่งไปให้', - 'auth.err.exists': 'มีบัญชีที่ใช้อีเมลนี้อยู่แล้ว', 'auth.err.weak': 'รหัสผ่านไม่ปลอดภัยพอ (อย่างน้อย {n} ตัวอักษร ผสมตัวอักษรและตัวเลข)', 'auth.err.pwned': "รหัสผ่านนี้เคยหลุดในเหตุข้อมูลรั่วไหลที่ทราบกัน — โปรดเลือกรหัสอื่น", 'auth.err.samePassword': 'รหัสผ่านใหม่ต้องไม่ซ้ำกับรหัสผ่านเดิม', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'นำเข้าไม่สำเร็จ', 'account.newPasswordPh': 'รหัสผ่านใหม่ (อย่างน้อย {n} ตัวอักษร)', 'account.changePassword': 'เปลี่ยนรหัสผ่าน', + 'mfa.title': "การยืนยันตัวตนสองขั้นตอน", + 'mfa.on': "เปิด", + 'mfa.off': "ปิด", + 'mfa.enable': "เปิดใช้", + 'mfa.disable': "ปิดใช้", + 'mfa.scan': "สแกน QR โค้ดนี้ด้วยแอปยืนยันตัวตน (Google Authenticator, Authy…) แล้วกรอกรหัส 6 หลักที่แสดง", + 'mfa.secret': "หรือกรอกคีย์นี้:", + 'mfa.code': "รหัส 6 หลัก", + 'mfa.confirm': "ยืนยัน", + 'mfa.enabled': "เปิดการยืนยันตัวตนสองขั้นตอนแล้ว", + 'mfa.disabled': "ปิดการยืนยันตัวตนสองขั้นตอนแล้ว", + 'mfa.loginText': "เปิดแอปยืนยันตัวตนแล้วกรอกรหัส 6 หลัก", + 'mfa.err.code': "รหัสไม่ถูกต้องหรือหมดอายุ", 'account.logout': 'ออกจากระบบ', 'account.logoutHint': 'ข้อมูลของคุณยังอยู่ในบัญชี และจะถูกนำออกจากอุปกรณ์นี้', 'account.ignore': 'ข้าม', diff --git a/src/i18n/locales/tr.ts b/src/i18n/locales/tr.ts index 69459f9..04ce287 100644 --- a/src/i18n/locales/tr.ts +++ b/src/i18n/locales/tr.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Yeni şifre', 'auth.err.credentials': 'E-posta veya şifre hatalı.', 'auth.err.notConfirmed': 'Önce e-postayla gelen bağlantıyla adresini onayla.', - 'auth.err.exists': 'Bu e-postayla zaten bir hesap var.', 'auth.err.weak': 'Şifre çok zayıf (en az {n} karakter, harf ve rakam karışık).', 'auth.err.pwned': "Bu şifre bilinen bir veri sızıntısında yer aldı — lütfen başka bir şifre seç.", 'auth.err.samePassword': 'Yeni şifren eskisinden farklı olmalı.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'İçe aktarma başarısız oldu.', 'account.newPasswordPh': 'Yeni şifre (en az {n} karakter)', 'account.changePassword': 'Şifreyi değiştir', + 'mfa.title': "İki adımlı doğrulama", + 'mfa.on': "Açık", + 'mfa.off': "Kapalı", + 'mfa.enable': "Aç", + 'mfa.disable': "Kapat", + 'mfa.scan': "Bu QR kodunu kimlik doğrulama uygulamanla (Google Authenticator, Authy…) tara ve gösterilen 6 haneli kodu gir.", + 'mfa.secret': "Ya da bu anahtarı gir:", + 'mfa.code': "6 haneli kod", + 'mfa.confirm': "Onayla", + 'mfa.enabled': "İki adımlı doğrulama açıldı.", + 'mfa.disabled': "İki adımlı doğrulama kapatıldı.", + 'mfa.loginText': "Kimlik doğrulama uygulamanı aç ve 6 haneli kodu gir.", + 'mfa.err.code': "Kod yanlış veya süresi dolmuş.", 'account.logout': 'Çıkış yap', 'account.logoutHint': 'Verilerin hesabında kalır ve bu cihazdan kaldırılır.', 'account.ignore': 'Yoksay', diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index 63d4a74..b43a8a0 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': 'Mật khẩu mới', 'auth.err.credentials': 'Email hoặc mật khẩu không đúng.', 'auth.err.notConfirmed': 'Hãy xác nhận địa chỉ email trước bằng liên kết đã gửi cho bạn.', - 'auth.err.exists': 'Đã có tài khoản dùng email này.', 'auth.err.weak': 'Mật khẩu quá yếu (ít nhất {n} ký tự, kết hợp chữ và số).', 'auth.err.pwned': "Mật khẩu này đã xuất hiện trong một vụ rò rỉ dữ liệu đã biết — hãy chọn mật khẩu khác.", 'auth.err.samePassword': 'Mật khẩu mới phải khác mật khẩu cũ.', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': 'Nhập dữ liệu thất bại.', 'account.newPasswordPh': 'Mật khẩu mới (tối thiểu {n} ký tự)', 'account.changePassword': 'Đổi mật khẩu', + 'mfa.title': "Xác thực hai lớp", + 'mfa.on': "Đang bật", + 'mfa.off': "Đang tắt", + 'mfa.enable': "Bật", + 'mfa.disable': "Tắt", + 'mfa.scan': "Quét mã QR này bằng ứng dụng xác thực (Google Authenticator, Authy…), rồi nhập mã 6 chữ số hiển thị.", + 'mfa.secret': "Hoặc nhập khóa này:", + 'mfa.code': "Mã 6 chữ số", + 'mfa.confirm': "Xác nhận", + 'mfa.enabled': "Đã bật xác thực hai lớp.", + 'mfa.disabled': "Đã tắt xác thực hai lớp.", + 'mfa.loginText': "Mở ứng dụng xác thực và nhập mã 6 chữ số.", + 'mfa.err.code': "Mã sai hoặc đã hết hạn.", 'account.logout': 'Đăng xuất', 'account.logoutHint': 'Dữ liệu vẫn nằm trong tài khoản của bạn và được gỡ khỏi thiết bị này.', 'account.ignore': 'Bỏ qua', diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index bab8017..c171cac 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -192,7 +192,6 @@ const dict: Translations = { 'auth.newPassword': '新密码', 'auth.err.credentials': '邮箱或密码错误。', 'auth.err.notConfirmed': '请先通过邮件里的链接验证你的邮箱。', - 'auth.err.exists': '该邮箱已注册账号。', 'auth.err.weak': '密码太弱(至少{n}个字符,需混合字母和数字)。', 'auth.err.pwned': "此密码曾出现在已知的数据泄露中,请换一个。", 'auth.err.samePassword': '新密码不能与旧密码相同。', @@ -342,6 +341,19 @@ const dict: Translations = { 'account.importFailed': '导入失败。', 'account.newPasswordPh': '新密码(至少{n}个字符)', 'account.changePassword': '修改密码', + 'mfa.title': "双重验证", + 'mfa.on': "已开启", + 'mfa.off': "已关闭", + 'mfa.enable': "开启", + 'mfa.disable': "关闭", + 'mfa.scan': "用身份验证器应用(Google Authenticator、Authy 等)扫描此二维码,然后输入显示的 6 位验证码。", + 'mfa.secret': "或输入此密钥:", + 'mfa.code': "6 位验证码", + 'mfa.confirm': "确认", + 'mfa.enabled': "双重验证已开启。", + 'mfa.disabled': "双重验证已关闭。", + 'mfa.loginText': "打开身份验证器应用并输入 6 位验证码。", + 'mfa.err.code': "验证码错误或已过期。", 'account.logout': '退出登录', 'account.logoutHint': '你的数据会保留在账号中,并从这台设备上移除。', 'account.ignore': '忽略', diff --git a/src/lib/cloud/auth.ts b/src/lib/cloud/auth.ts index ae96578..407062c 100644 --- a/src/lib/cloud/auth.ts +++ b/src/lib/cloud/auth.ts @@ -16,7 +16,10 @@ export interface Session { user: { id: string; email: string } } -export class AuthError extends Error {} +export class AuthError extends Error { + /** Code d'erreur Supabase Auth (ex. « user_already_exists ») */ + code?: string +} const KEY = 'azuucine:session' const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i @@ -90,8 +93,6 @@ const CODE_KEYS: Record = { invalid_credentials: 'auth.err.credentials', invalid_grant: 'auth.err.credentials', email_not_confirmed: 'auth.err.notConfirmed', - user_already_exists: 'auth.err.exists', - email_exists: 'auth.err.exists', weak_password: 'auth.err.weak', same_password: 'auth.err.samePassword', over_email_send_rate_limit: 'auth.err.emailRate', @@ -136,6 +137,7 @@ async function gotrue(path: string, init: { method?: string; body?: unknown; tok const code = String(data.error_code ?? data.code ?? data.error ?? '') const err = new AuthError(msg(code) ?? (res.status === 429 ? t('auth.err.rate') : t('auth.err.status', { status: res.status }))) ;(err as AuthError & { status: number }).status = res.status + err.code = code || undefined throw err } return data @@ -169,9 +171,17 @@ export async function signIn(email: string, password: string): Promise { export async function signUp(email: string, password: string, username?: string): Promise { if (password.length < PASSWORD_MIN) throw new AuthError(t('auth.err.weak', { n: PASSWORD_MIN })) if (await isPwnedPassword(password)) throw new AuthError(t('auth.err.pwned')) - const data = await gotrue(`/signup?redirect_to=${encodeURIComponent(appUrl())}`, { - body: { email: cleanEmail(email), password, ...(username ? { data: { username } } : {}) }, - }) + let data: Record + try { + data = await gotrue(`/signup?redirect_to=${encodeURIComponent(appUrl())}`, { + body: { email: cleanEmail(email), password, ...(username ? { data: { username } } : {}) }, + }) + } catch (e) { + // Adresse déjà inscrite : même réponse qu'une inscription normale (« regarde tes emails »), + // pour ne jamais révéler qui a un compte + if (e instanceof AuthError && (e.code === 'user_already_exists' || e.code === 'email_exists')) return true + throw e + } const s = toSession(data) if (s) { setSession(s) @@ -397,3 +407,111 @@ export async function consumeAuthRedirect(): Promise<{ type?: string; error?: st return { error: (e as Error).message } } } + +// ───────────────────────────── Double authentification (TOTP) ───────────────────────────── + +/** Niveau d'assurance de la session : « aal2 » une fois le code de l'application d'authentification saisi. */ +export function sessionAal(): string | undefined { + const token = current?.accessToken + if (!token) return undefined + try { + const part = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/') + const claims = JSON.parse(atob(part.padEnd(part.length + ((4 - (part.length % 4)) % 4), '='))) as { aal?: unknown } + return typeof claims.aal === 'string' ? claims.aal : undefined + } catch { + return undefined + } +} + +export interface MfaFactor { + id: string + verified: boolean +} + +const FACTOR_ID = /^[0-9a-f-]{36}$/i + +async function mfaToken(): Promise { + const token = await getAccessToken() + if (!token) throw new AuthError(t('auth.err.session')) + return token +} + +/** Facteurs TOTP du compte (vérifiés ou en cours d'activation). */ +export async function listTotpFactors(): Promise { + const user = await gotrue('/user', { method: 'GET', token: await mfaToken() }) + const factors = Array.isArray(user.factors) ? (user.factors as { id?: unknown; status?: unknown; factor_type?: unknown }[]) : [] + return factors + .filter((f) => typeof f.id === 'string' && FACTOR_ID.test(f.id) && f.factor_type === 'totp') + .map((f) => ({ id: f.id as string, verified: f.status === 'verified' })) +} + +const mfaKey = (userId: string) => `azuucine:mfa:${userId}` +/** Dernier état connu (pour ne pas bloquer le lancement quand le compte n'a pas de double authentification). */ +export function knownMfa(): boolean | undefined { + if (!current) return undefined + try { + const v = localStorage.getItem(mfaKey(current.user.id)) + return v === '1' ? true : v === '0' ? false : undefined + } catch { + return undefined + } +} +function rememberMfa(on: boolean) { + if (!current) return + try { + localStorage.setItem(mfaKey(current.user.id), on ? '1' : '0') + } catch { + /* ignore */ + } +} + +/** Facteur à valider avant d'entrer dans l'app (null : rien à faire). */ +export async function pendingMfaFactor(): Promise { + const factors = await listTotpFactors() + const verified = factors.find((f) => f.verified) + rememberMfa(!!verified) + if (!verified || sessionAal() === 'aal2') return null + return verified.id +} + +/** Valide un code à 6 chiffres : la session passe au niveau « aal2 ». */ +export async function verifyTotp(factorId: string, code: string): Promise { + if (!FACTOR_ID.test(factorId)) throw new AuthError(t('auth.err.invalid')) + const clean = code.replace(/\s/g, '') + if (!/^\d{6}$/.test(clean)) throw new AuthError(t('mfa.err.code')) + const token = await mfaToken() + const challenge = await gotrue(`/factors/${factorId}/challenge`, { token }) + if (typeof challenge.id !== 'string') throw new AuthError(t('auth.err.response')) + let data: Record + try { + data = await gotrue(`/factors/${factorId}/verify`, { token, body: { challenge_id: challenge.id, code: clean } }) + } catch (e) { + if (e instanceof AuthError && (e.code === 'mfa_verification_failed' || e.code === 'invalid_credentials')) throw new AuthError(t('mfa.err.code')) + throw e + } + const s = toSession({ ...data, user: data.user ?? { id: current?.user.id, email: current?.user.email } }) + if (!s || (current && s.user.id !== current.user.id)) throw new AuthError(t('auth.err.response')) + setSession(s) + rememberMfa(true) +} + +/** Début d'activation : QR code et clé à recopier dans l'application d'authentification. */ +export async function enrollTotp(): Promise<{ id: string; qr: string; secret: string }> { + const token = await mfaToken() + // Une activation abandonnée laisse un facteur non vérifié : on repart de zéro + for (const f of await listTotpFactors()) if (!f.verified) await gotrue(`/factors/${f.id}`, { method: 'DELETE', token }).catch(() => {}) + const data = await gotrue('/factors', { token, body: { factor_type: 'totp', friendly_name: `Bobinoo ${Date.now().toString(36)}` } }) + const totp = data.totp as { qr_code?: unknown; secret?: unknown } | undefined + const qr = typeof totp?.qr_code === 'string' && totp.qr_code.startsWith('data:image/svg+xml') ? totp.qr_code : '' + if (typeof data.id !== 'string' || !FACTOR_ID.test(data.id) || typeof totp?.secret !== 'string') throw new AuthError(t('auth.err.response')) + return { id: data.id, qr, secret: totp.secret } +} + +/** Désactive la double authentification (demande une session « aal2 »). */ +export async function removeTotp(factorId: string): Promise { + if (!FACTOR_ID.test(factorId)) throw new AuthError(t('auth.err.invalid')) + await gotrue(`/factors/${factorId}`, { method: 'DELETE', token: await mfaToken() }) + // La session « aal2 » reste valable ; on rafraîchit pour repartir d'un jeton à jour + await getAccessToken(true).catch(() => null) + rememberMfa(false) +} diff --git a/src/store.tsx b/src/store.tsx index 66e125a..503ae50 100644 --- a/src/store.tsx +++ b/src/store.tsx @@ -399,8 +399,13 @@ export function MediaProvider({ [setItems], ) + // Double tap involontaire sur « +1 » : un seul épisode compté (même fiche, à moins de 400 ms d'intervalle) + const lastIncrement = useRef(new Map()) const incrementEpisode = useCallback( async (id: string, delta = 1) => { + const now = Date.now() + if (now - (lastIncrement.current.get(id) ?? 0) < 400) return + lastIncrement.current.set(id, now) const item = itemsRef.current.find((i) => i.id === id) if (!item) return // Revisionnage : on avance sa propre progression (le premier visionnage ne bouge pas) diff --git a/supabase/functions/_shared/auth.ts b/supabase/functions/_shared/auth.ts index 82b98a1..d901b43 100644 --- a/supabase/functions/_shared/auth.ts +++ b/supabase/functions/_shared/auth.ts @@ -45,7 +45,18 @@ function remember(token: string, id: string | null, ttlMs: number) { verified.set(token, { id, until: Date.now() + ttlMs }) } -/** Vérifie le jeton de connexion auprès de Supabase Auth. Renvoie l'id de l'utilisateur, ou null. */ +/** Niveau d'assurance inscrit dans le jeton (déjà vérifié par Supabase Auth juste avant). */ +function tokenAal(token: string): string | undefined { + try { + const part = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/') + const claims = JSON.parse(atob(part.padEnd(part.length + ((4 - (part.length % 4)) % 4), '='))) as { aal?: unknown } + return typeof claims.aal === 'string' ? claims.aal : undefined + } catch { + return undefined + } +} + +/** Vérifie le jeton de connexion auprès de Supabase Auth. Renvoie l'id de l'utilisateur, ou null (aussi si la double authentification n'a pas été validée). */ export async function getUserId(req: Request): Promise { const auth = req.headers.get('Authorization') ?? '' const token = auth.startsWith('Bearer ') ? auth.slice(7).trim() : '' @@ -67,8 +78,14 @@ export async function getUserId(req: Request): Promise { if (res.status === 401 || res.status === 403) remember(token, null, 30_000) return null } - const user = (await res.json().catch(() => ({}))) as { id?: string } + const user = (await res.json().catch(() => ({}))) as { id?: string; factors?: { status?: string }[] } if (typeof user.id !== 'string') return null + // Double authentification activée : le jeton doit avoir été obtenu avec le code (niveau « aal2 ») + const mfa = Array.isArray(user.factors) && user.factors.some((f) => f?.status === 'verified') + if (mfa && tokenAal(token) !== 'aal2') { + remember(token, null, 30_000) + return null + } remember(token, user.id, 60_000) return user.id } diff --git a/supabase/migrations/20261128160000_mfa_enforcement.sql b/supabase/migrations/20261128160000_mfa_enforcement.sql new file mode 100644 index 0000000..efbc2c4 --- /dev/null +++ b/supabase/migrations/20261128160000_mfa_enforcement.sql @@ -0,0 +1,35 @@ +-- Bobinoo — double authentification (28 nov. 2026). Idempotent. +-- Un compte qui a activé la double authentification n'accède à ses données, à l'administration +-- et aux actions sociales qu'avec une session validée par le code (niveau « aal2 »). +-- Les comptes sans double authentification ne voient aucune différence. + +create or replace function public.azuu_mfa_ok() +returns boolean language sql stable security definer set search_path = '' as $$ + select coalesce(auth.jwt()->>'aal', '') = 'aal2' + or not exists (select 1 from auth.mfa_factors f where f.user_id = auth.uid() and f.status = 'verified') +$$; +revoke execute on function public.azuu_mfa_ok() from public, anon; +grant execute on function public.azuu_mfa_ok() to authenticated; + +-- Données du compte (accès direct) : règle restrictive qui s'ajoute aux règles existantes +do $$ +declare t text; +begin + foreach t in array array['items', 'lists', 'settings', 'follows', 'profiles', 'activity'] loop + execute format('drop policy if exists "mfa required" on public.%I', t); + execute format('create policy "mfa required" on public.%I as restrictive for all to authenticated using ((select public.azuu_mfa_ok())) with check ((select public.azuu_mfa_ok()))', t); + end loop; +end $$; + +-- Administration et actions sociales (listes partagées, abonnements, réactions…) +create or replace function public.is_admin() +returns boolean language sql stable security definer set search_path = '' as $$ + select exists (select 1 from public.admins a where a.user_id = auth.uid()) and public.azuu_mfa_ok() +$$; + +create or replace function public.azuu_me_active() +returns boolean language sql stable security definer set search_path = '' as $$ + select auth.uid() is not null + and exists (select 1 from public.profiles p where p.id = auth.uid() and not p.suspended) + and public.azuu_mfa_ok() +$$;