The minimalistic document archiving platform.
feat(authentication): added 2FA support (#717)
Corentin Thomassetf3fb5ff46a02
diff --git a/.changeset/old-jars-fix.md b/.changeset/old-jars-fix.mdnew file mode 100644index 00000000..c00f21ac--- /dev/null+++ b/.changeset/old-jars-fix.md@@ -0,0 +1,5 @@+---+"@papra/docker": patch+---++Added support for two factor authenticationdiff --git a/apps/papra-client/package.json b/apps/papra-client/package.jsonindex 4712fbd7..769640e9 100644--- a/apps/papra-client/package.json+++ b/apps/papra-client/package.json@@ -29,6 +29,7 @@"dependencies": {"@branchlet/core": "^1.0.0","@corentinth/chisels": "catalog:",+ "@corvu/otp-field": "^0.1.4","@kobalte/core": "^0.13.10","@kobalte/utils": "^0.9.1","@modular-forms/solid": "^0.25.1",@@ -50,6 +51,7 @@"tailwind-merge": "^2.6.0","unocss-preset-animations": "^1.3.0","unstorage": "^1.16.0",+ "uqr": "^0.1.2","valibot": "1.0.0-beta.10"},"devDependencies": {diff --git a/apps/papra-client/src/locales/de.dictionary.ts b/apps/papra-client/src/locales/de.dictionary.tsindex 0d66f8a9..4fb2a9e2 100644--- a/apps/papra-client/src/locales/de.dictionary.ts+++ b/apps/papra-client/src/locales/de.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Passwort vergessen?','auth.login.form.submit': 'Anmelden',+ 'auth.login.two-factor.title': 'Zwei-Faktor-Verifizierung',+ 'auth.login.two-factor.description.totp': 'Geben Sie den 6-stelligen Verifizierungscode aus Ihrer Authentifizierungs-App ein.',+ 'auth.login.two-factor.description.backup-code': 'Geben Sie einen Ihrer Backup-Codes ein, um auf Ihr Konto zuzugreifen.',+ 'auth.login.two-factor.code.label.totp': 'Authentifizierungscode',+ 'auth.login.two-factor.code.label.backup-code': 'Backup-Code',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Backup-Code eingeben',+ 'auth.login.two-factor.code.required': 'Bitte geben Sie den Verifizierungscode ein',+ 'auth.login.two-factor.trust-device.label': 'Diesem Gerät 30 Tage lang vertrauen',+ 'auth.login.two-factor.back': 'Zurück zur Anmeldung',+ 'auth.login.two-factor.submit': 'Verifizieren',+ 'auth.login.two-factor.verification-failed': 'Verifizierung fehlgeschlagen. Bitte überprüfen Sie Ihren Code und versuchen Sie es erneut.',+ 'auth.login.two-factor.use-backup-code': 'Stattdessen Backup-Code verwenden',+ 'auth.login.two-factor.use-totp': 'Stattdessen Authentifizierungs-App verwenden',+'auth.register.title': 'Bei Papra registrieren','auth.register.description': 'Erstellen Sie ein Konto, um Papra zu nutzen.','auth.register.register-with-email': 'Mit E-Mail registrieren',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Melden Sie sich von Ihrem Konto ab. Sie können sich später wieder anmelden.','user.settings.logout.button': 'Abmelden',+ 'user.settings.two-factor.title': 'Zwei-Faktor-Authentifizierung',+ 'user.settings.two-factor.description': 'Fügen Sie Ihrem Konto eine zusätzliche Sicherheitsebene hinzu.',+ 'user.settings.two-factor.status.enabled': 'Aktiviert',+ 'user.settings.two-factor.status.disabled': 'Deaktiviert',+ 'user.settings.two-factor.enable-button': '2FA aktivieren',+ 'user.settings.two-factor.disable-button': '2FA deaktivieren',+ 'user.settings.two-factor.regenerate-codes-button': 'Backup-Codes neu generieren',++ 'user.settings.two-factor.enable-dialog.title': 'Zwei-Faktor-Authentifizierung aktivieren',+ 'user.settings.two-factor.enable-dialog.description': 'Geben Sie Ihr Passwort ein, um 2FA zu aktivieren.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Passwort',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.enable-dialog.password.required': 'Bitte geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.enable-dialog.cancel': 'Abbrechen',+ 'user.settings.two-factor.enable-dialog.submit': 'Fortfahren',++ 'user.settings.two-factor.setup-dialog.title': 'Zwei-Faktor-Authentifizierung einrichten',+ 'user.settings.two-factor.setup-dialog.description': 'Scannen Sie diesen QR-Code mit Ihrer Authentifizierungs-App und geben Sie dann den Verifizierungscode ein.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'QR-Code wird geladen...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Schritt 1: QR-Code scannen',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scannen Sie den untenstehenden QR-Code oder geben Sie den Einrichtungsschlüssel manuell in Ihre Authentifizierungs-App ein.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Einrichtungsschlüssel kopieren',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Schritt 2: Code verifizieren',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Geben Sie den 6-stelligen Code ein, der von Ihrer Authentifizierungs-App generiert wurde, um die Zwei-Faktor-Authentifizierung zu verifizieren und zu aktivieren.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Verifizierungscode',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Geben Sie den 6-stelligen Code ein',+ 'user.settings.two-factor.setup-dialog.code.required': 'Bitte geben Sie den Verifizierungscode ein',+ 'user.settings.two-factor.setup-dialog.cancel': 'Abbrechen',+ 'user.settings.two-factor.setup-dialog.verify': '2FA verifizieren und aktivieren',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Backup-Codes',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Bewahren Sie diese Backup-Codes an einem sicheren Ort auf. Sie können sie verwenden, um auf Ihr Konto zuzugreifen, wenn Sie den Zugang zu Ihrer Authentifizierungs-App verlieren.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Jeder Code kann nur einmal verwendet werden.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Backup-Codes kopieren',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Backup-Codes herunterladen',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Codes in die Zwischenablage kopiert',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Ich habe meine Codes gespeichert',++ 'user.settings.two-factor.disable-dialog.title': 'Zwei-Faktor-Authentifizierung deaktivieren',+ 'user.settings.two-factor.disable-dialog.description': 'Geben Sie Ihr Passwort ein, um 2FA zu deaktivieren. Dies macht Ihr Konto weniger sicher.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Passwort',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.disable-dialog.password.required': 'Bitte geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.disable-dialog.cancel': 'Abbrechen',+ 'user.settings.two-factor.disable-dialog.submit': '2FA deaktivieren',++ 'user.settings.two-factor.regenerate-dialog.title': 'Backup-Codes neu generieren',+ 'user.settings.two-factor.regenerate-dialog.description': 'Dies macht alle bestehenden Backup-Codes ungültig und generiert neue. Geben Sie Ihr Passwort ein, um fortzufahren.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Passwort',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Bitte geben Sie Ihr Passwort ein',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Abbrechen',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Codes neu generieren',++ 'user.settings.two-factor.enabled': 'Zwei-Faktor-Authentifizierung wurde aktiviert',+ 'user.settings.two-factor.disabled': 'Zwei-Faktor-Authentifizierung wurde deaktiviert',+ 'user.settings.two-factor.codes-regenerated': 'Backup-Codes wurden neu generiert',+ 'user.settings.two-factor.verification-failed': 'Verifizierung fehlgeschlagen. Bitte überprüfen Sie Ihren Code und versuchen Sie es erneut.',+// Organizations'organizations.list.title': 'Ihre Organisationen',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Fehler beim Trennen des letzten Kontos','api-errors.ACCOUNT_NOT_FOUND': 'Konto nicht gefunden','api-errors.USER_ALREADY_HAS_PASSWORD': 'Benutzer hat bereits ein Passwort',+ 'api-errors.INVALID_CODE': 'Der angegebene Code ist ungültig oder abgelaufen',+ 'api-errors.OTP_NOT_ENABLED': 'Zwei-Faktor-Authentifizierung ist für dieses Konto nicht aktiviert',+ 'api-errors.OTP_HAS_EXPIRED': 'Der Zwei-Faktor-Authentifizierungscode ist abgelaufen',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP ist für dieses Konto nicht aktiviert',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'Zwei-Faktor-Authentifizierung ist für dieses Konto nicht aktiviert',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Backup-Codes sind für dieses Konto nicht aktiviert',+ 'api-errors.INVALID_BACKUP_CODE': 'Der angegebene Backup-Code ist ungültig oder wurde bereits verwendet',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Zu viele Versuche. Bitte fordern Sie einen neuen Code an.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Ungültiges Zwei-Faktor-Cookie',// Not founddiff --git a/apps/papra-client/src/locales/en.dictionary.ts b/apps/papra-client/src/locales/en.dictionary.tsindex 9b902240..45da9151 100644--- a/apps/papra-client/src/locales/en.dictionary.ts+++ b/apps/papra-client/src/locales/en.dictionary.ts@@ -40,6 +40,20 @@ export const translations = {'auth.login.form.forgot-password.label': 'Forgot password?','auth.login.form.submit': 'Login',+ 'auth.login.two-factor.title': 'Two-Factor Verification',+ 'auth.login.two-factor.description.totp': 'Enter the 6-digit verification code from your authenticator app.',+ 'auth.login.two-factor.description.backup-code': 'Enter one of your backup codes to access your account.',+ 'auth.login.two-factor.code.label.totp': 'Authenticator code',+ 'auth.login.two-factor.code.label.backup-code': 'Backup code',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Enter backup code',+ 'auth.login.two-factor.code.required': 'Please enter the verification code',+ 'auth.login.two-factor.trust-device.label': 'Trust this device for 30 days',+ 'auth.login.two-factor.back': 'Back to login',+ 'auth.login.two-factor.submit': 'Verify',+ 'auth.login.two-factor.verification-failed': 'Verification failed. Please check your code and try again.',+ 'auth.login.two-factor.use-backup-code': 'Use backup code instead',+ 'auth.login.two-factor.use-totp': 'Use authenticator app instead',+'auth.register.title': 'Register to Papra','auth.register.description': 'Create an account to start using Papra.','auth.register.register-with-email': 'Register with email',@@ -102,6 +116,66 @@ export const translations = {'user.settings.logout.description': 'Logout from your account. You can login again later.','user.settings.logout.button': 'Logout',+ 'user.settings.two-factor.title': 'Two-Factor Authentication',+ 'user.settings.two-factor.description': 'Add an extra layer of security to your account.',+ 'user.settings.two-factor.status.enabled': 'Enabled',+ 'user.settings.two-factor.status.disabled': 'Disabled',+ 'user.settings.two-factor.enable-button': 'Enable 2FA',+ 'user.settings.two-factor.disable-button': 'Disable 2FA',+ 'user.settings.two-factor.regenerate-codes-button': 'Regenerate backup codes',++ 'user.settings.two-factor.enable-dialog.title': 'Enable Two-Factor Authentication',+ 'user.settings.two-factor.enable-dialog.description': 'Enter your password to enable 2FA.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Password',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Enter your password',+ 'user.settings.two-factor.enable-dialog.password.required': 'Please enter your password',+ 'user.settings.two-factor.enable-dialog.cancel': 'Cancel',+ 'user.settings.two-factor.enable-dialog.submit': 'Continue',++ 'user.settings.two-factor.setup-dialog.title': 'Set Up Two-Factor Authentication',+ 'user.settings.two-factor.setup-dialog.description': 'Scan this QR code with your authenticator app, then enter the verification code.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Loading QR code...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Step 1: Scan the QR code',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scan the QR code below or manually enter the setup key into your authenticator app.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copy setup key',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Step 2: Verify the code',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Enter the 6-digit code generated by your authenticator app to verify and enable two-factor authentication.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Verification code',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Enter 6-digit code',+ 'user.settings.two-factor.setup-dialog.code.required': 'Please enter the verification code',+ 'user.settings.two-factor.setup-dialog.cancel': 'Cancel',+ 'user.settings.two-factor.setup-dialog.verify': 'Verify and enable 2FA',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Backup Codes',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Save these backup codes in a safe place. You can use them to access your account if you lose access to your authenticator app.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Each code can only be used once.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copy backup codes',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Download backup codes',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Codes copied to clipboard',+ 'user.settings.two-factor.backup-codes-dialog.close': 'I\'ve saved my codes',++ 'user.settings.two-factor.disable-dialog.title': 'Disable Two-Factor Authentication',+ 'user.settings.two-factor.disable-dialog.description': 'Enter your password to disable 2FA. This will make your account less secure.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Password',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Enter your password',+ 'user.settings.two-factor.disable-dialog.password.required': 'Please enter your password',+ 'user.settings.two-factor.disable-dialog.cancel': 'Cancel',+ 'user.settings.two-factor.disable-dialog.submit': 'Disable 2FA',++ 'user.settings.two-factor.regenerate-dialog.title': 'Regenerate Backup Codes',+ 'user.settings.two-factor.regenerate-dialog.description': 'This will invalidate all existing backup codes and generate new ones. Enter your password to continue.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Password',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Enter your password',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Please enter your password',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Cancel',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Regenerate codes',++ 'user.settings.two-factor.enabled': 'Two-factor authentication has been enabled',+ 'user.settings.two-factor.disabled': 'Two-factor authentication has been disabled',+ 'user.settings.two-factor.codes-regenerated': 'Backup codes have been regenerated',+ 'user.settings.two-factor.verification-failed': 'Verification failed. Please check your code and try again.',+// Organizations'organizations.list.title': 'Your organizations',@@ -639,6 +713,15 @@ export const translations = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Failed to unlink last account','api-errors.ACCOUNT_NOT_FOUND': 'Account not found','api-errors.USER_ALREADY_HAS_PASSWORD': 'User already has password',+ 'api-errors.INVALID_CODE': 'The provided code is invalid or has expired',+ 'api-errors.OTP_NOT_ENABLED': 'Two-factor authentication is not enabled for this account',+ 'api-errors.OTP_HAS_EXPIRED': 'The two-factor authentication code has expired',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP is not enabled for this account',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'Two-factor authentication is not enabled for this account',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Backup codes are not enabled for this account',+ 'api-errors.INVALID_BACKUP_CODE': 'The provided backup code is invalid or has already been used',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Too many attempts. Please request a new code.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Invalid two factor cookie',// Not founddiff --git a/apps/papra-client/src/locales/es.dictionary.ts b/apps/papra-client/src/locales/es.dictionary.tsindex c0bc367f..0f95e36d 100644--- a/apps/papra-client/src/locales/es.dictionary.ts+++ b/apps/papra-client/src/locales/es.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': '¿Olvidaste tu contraseña?','auth.login.form.submit': 'Iniciar sesión',+ 'auth.login.two-factor.title': 'Verificación en dos pasos',+ 'auth.login.two-factor.description.totp': 'Introduce el código de verificación de 6 dígitos de tu aplicación autenticadora.',+ 'auth.login.two-factor.description.backup-code': 'Introduce uno de tus códigos de respaldo para acceder a tu cuenta.',+ 'auth.login.two-factor.code.label.totp': 'Código de autenticación',+ 'auth.login.two-factor.code.label.backup-code': 'Código de respaldo',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Introduce el código de respaldo',+ 'auth.login.two-factor.code.required': 'Por favor, introduce el código de verificación',+ 'auth.login.two-factor.trust-device.label': 'Confiar en este dispositivo durante 30 días',+ 'auth.login.two-factor.back': 'Volver al inicio de sesión',+ 'auth.login.two-factor.submit': 'Verificar',+ 'auth.login.two-factor.verification-failed': 'Verificación fallida. Por favor, verifica tu código e inténtalo de nuevo.',+ 'auth.login.two-factor.use-backup-code': 'Usar código de respaldo',+ 'auth.login.two-factor.use-totp': 'Usar aplicación autenticadora',+'auth.register.title': 'Regístrate en Papra','auth.register.description': 'Crea una cuenta para comenzar a usar Papra.','auth.register.register-with-email': 'Registrarse con correo electrónico',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Cierra la sesión de tu cuenta. Puedes iniciar sesión nuevamente más tarde.','user.settings.logout.button': 'Cerrar sesión',+ 'user.settings.two-factor.title': 'Autenticación de dos factores',+ 'user.settings.two-factor.description': 'Añade una capa adicional de seguridad a tu cuenta.',+ 'user.settings.two-factor.status.enabled': 'Activada',+ 'user.settings.two-factor.status.disabled': 'Desactivada',+ 'user.settings.two-factor.enable-button': 'Activar A2F',+ 'user.settings.two-factor.disable-button': 'Desactivar A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Regenerar códigos de respaldo',++ 'user.settings.two-factor.enable-dialog.title': 'Activar autenticación de dos factores',+ 'user.settings.two-factor.enable-dialog.description': 'Introduce tu contraseña para activar A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Contraseña',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Introduce tu contraseña',+ 'user.settings.two-factor.enable-dialog.password.required': 'Por favor, introduce tu contraseña',+ 'user.settings.two-factor.enable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.enable-dialog.submit': 'Continuar',++ 'user.settings.two-factor.setup-dialog.title': 'Configurar autenticación de dos factores',+ 'user.settings.two-factor.setup-dialog.description': 'Escanea este código QR con tu aplicación autenticadora y luego introduce el código de verificación.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Cargando código QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Paso 1: Escanear el código QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Escanea el código QR a continuación o introduce manualmente la clave de configuración en tu aplicación autenticadora.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copiar clave de configuración',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Paso 2: Verificar el código',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Introduce el código de 6 dígitos generado por tu aplicación autenticadora para verificar y activar la autenticación de dos factores.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Código de verificación',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Introduce el código de 6 dígitos',+ 'user.settings.two-factor.setup-dialog.code.required': 'Por favor, introduce el código de verificación',+ 'user.settings.two-factor.setup-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.setup-dialog.verify': 'Verificar y activar A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Códigos de respaldo',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Guarda estos códigos de respaldo en un lugar seguro. Puedes usarlos para acceder a tu cuenta si pierdes el acceso a tu aplicación autenticadora.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Cada código solo se puede usar una vez.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copiar códigos de respaldo',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Descargar códigos de respaldo',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Códigos copiados al portapapeles',+ 'user.settings.two-factor.backup-codes-dialog.close': 'He guardado mis códigos',++ 'user.settings.two-factor.disable-dialog.title': 'Desactivar autenticación de dos factores',+ 'user.settings.two-factor.disable-dialog.description': 'Introduce tu contraseña para desactivar A2F. Esto hará que tu cuenta sea menos segura.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Contraseña',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Introduce tu contraseña',+ 'user.settings.two-factor.disable-dialog.password.required': 'Por favor, introduce tu contraseña',+ 'user.settings.two-factor.disable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.disable-dialog.submit': 'Desactivar A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Regenerar códigos de respaldo',+ 'user.settings.two-factor.regenerate-dialog.description': 'Esto invalidará todos los códigos de respaldo existentes y generará nuevos. Introduce tu contraseña para continuar.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Contraseña',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Introduce tu contraseña',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Por favor, introduce tu contraseña',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Regenerar códigos',++ 'user.settings.two-factor.enabled': 'La autenticación de dos factores ha sido activada',+ 'user.settings.two-factor.disabled': 'La autenticación de dos factores ha sido desactivada',+ 'user.settings.two-factor.codes-regenerated': 'Los códigos de respaldo han sido regenerados',+ 'user.settings.two-factor.verification-failed': 'Verificación fallida. Por favor, verifica tu código e inténtalo de nuevo.',+// Organizations'organizations.list.title': 'Tus organizaciones',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Error al desvincular la última cuenta','api-errors.ACCOUNT_NOT_FOUND': 'Cuenta no encontrada','api-errors.USER_ALREADY_HAS_PASSWORD': 'El usuario ya tiene contraseña',+ 'api-errors.INVALID_CODE': 'El código proporcionado es inválido o ha expirado',+ 'api-errors.OTP_NOT_ENABLED': 'La autenticación de dos factores no está activada para esta cuenta',+ 'api-errors.OTP_HAS_EXPIRED': 'El código de autenticación de dos factores ha expirado',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP no está activado para esta cuenta',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'La autenticación de dos factores no está activada para esta cuenta',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Los códigos de respaldo no están activados para esta cuenta',+ 'api-errors.INVALID_BACKUP_CODE': 'El código de respaldo proporcionado es inválido o ya ha sido usado',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Demasiados intentos. Por favor, solicita un nuevo código.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie de autenticación de dos factores inválida',// Not founddiff --git a/apps/papra-client/src/locales/fr.dictionary.ts b/apps/papra-client/src/locales/fr.dictionary.tsindex b840bf97..eef56137 100644--- a/apps/papra-client/src/locales/fr.dictionary.ts+++ b/apps/papra-client/src/locales/fr.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Mot de passe oublié ?','auth.login.form.submit': 'Connexion',+ 'auth.login.two-factor.title': 'Vérification en deux étapes',+ 'auth.login.two-factor.description.totp': 'Entrez le code de vérification à 6 chiffres de votre application d\'authentification.',+ 'auth.login.two-factor.description.backup-code': 'Entrez l\'un de vos codes de secours pour accéder à votre compte.',+ 'auth.login.two-factor.code.label.totp': 'Code d\'authentification',+ 'auth.login.two-factor.code.label.backup-code': 'Code de secours',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Entrez le code de secours',+ 'auth.login.two-factor.code.required': 'Veuillez entrer le code de vérification',+ 'auth.login.two-factor.trust-device.label': 'Faire confiance à cet appareil pendant 30 jours',+ 'auth.login.two-factor.back': 'Retour à la connexion',+ 'auth.login.two-factor.submit': 'Vérifier',+ 'auth.login.two-factor.verification-failed': 'Échec de la vérification. Veuillez vérifier votre code et réessayer.',+ 'auth.login.two-factor.use-backup-code': 'Utiliser un code de secours',+ 'auth.login.two-factor.use-totp': 'Utiliser l\'application d\'authentification',+'auth.register.title': 'S\'inscrire à Papra','auth.register.description': 'Créez un compte pour commencer à utiliser Papra.','auth.register.register-with-email': 'S\'inscrire avec email',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Déconnectez-vous de votre compte. Vous pouvez vous reconnecter plus tard.','user.settings.logout.button': 'Déconnexion',+ 'user.settings.two-factor.title': 'Authentification à deux facteurs',+ 'user.settings.two-factor.description': 'Ajoutez une couche de sécurité supplémentaire à votre compte.',+ 'user.settings.two-factor.status.enabled': 'Activée',+ 'user.settings.two-factor.status.disabled': 'Désactivée',+ 'user.settings.two-factor.enable-button': 'Activer l\'A2F',+ 'user.settings.two-factor.disable-button': 'Désactiver l\'A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Régénérer les codes de secours',++ 'user.settings.two-factor.enable-dialog.title': 'Activer l\'authentification à deux facteurs',+ 'user.settings.two-factor.enable-dialog.description': 'Entrez votre mot de passe pour activer l\'A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Mot de passe',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Entrez votre mot de passe',+ 'user.settings.two-factor.enable-dialog.password.required': 'Veuillez entrer votre mot de passe',+ 'user.settings.two-factor.enable-dialog.cancel': 'Annuler',+ 'user.settings.two-factor.enable-dialog.submit': 'Continuer',++ 'user.settings.two-factor.setup-dialog.title': 'Configurer l\'authentification à deux facteurs',+ 'user.settings.two-factor.setup-dialog.description': 'Scannez ce code QR avec votre application d\'authentification, puis entrez le code de vérification.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Chargement du code QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Étape 1 : Scanner le code QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scannez le code QR ci-dessous ou saisissez manuellement la clé de configuration dans votre application d\'authentification.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copier la clé de configuration',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Étape 2 : Vérifier le code',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Entrez le code à 6 chiffres généré par votre application d\'authentification pour vérifier et activer l\'authentification à deux facteurs.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Code de vérification',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Entrez le code à 6 chiffres',+ 'user.settings.two-factor.setup-dialog.code.required': 'Veuillez entrer le code de vérification',+ 'user.settings.two-factor.setup-dialog.cancel': 'Annuler',+ 'user.settings.two-factor.setup-dialog.verify': 'Vérifier et activer l\'A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Codes de secours',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Conservez ces codes de secours dans un endroit sûr. Vous pouvez les utiliser pour accéder à votre compte si vous perdez l\'accès à votre application d\'authentification.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Chaque code ne peut être utilisé qu\'une seule fois.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copier les codes de secours',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Télécharger les codes de secours',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Codes copiés dans le presse-papiers',+ 'user.settings.two-factor.backup-codes-dialog.close': 'J\'ai sauvegardé mes codes',++ 'user.settings.two-factor.disable-dialog.title': 'Désactiver l\'authentification à deux facteurs',+ 'user.settings.two-factor.disable-dialog.description': 'Entrez votre mot de passe pour désactiver l\'A2F. Cela rendra votre compte moins sécurisé.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Mot de passe',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Entrez votre mot de passe',+ 'user.settings.two-factor.disable-dialog.password.required': 'Veuillez entrer votre mot de passe',+ 'user.settings.two-factor.disable-dialog.cancel': 'Annuler',+ 'user.settings.two-factor.disable-dialog.submit': 'Désactiver l\'A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Régénérer les codes de secours',+ 'user.settings.two-factor.regenerate-dialog.description': 'Cela invalidera tous les codes de secours existants et en générera de nouveaux. Entrez votre mot de passe pour continuer.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Mot de passe',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Entrez votre mot de passe',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Veuillez entrer votre mot de passe',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Annuler',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Régénérer les codes',++ 'user.settings.two-factor.enabled': 'L\'authentification à deux facteurs a été activée',+ 'user.settings.two-factor.disabled': 'L\'authentification à deux facteurs a été désactivée',+ 'user.settings.two-factor.codes-regenerated': 'Les codes de secours ont été régénérés',+ 'user.settings.two-factor.verification-failed': 'Échec de la vérification. Veuillez vérifier votre code et réessayer.',+// Organizations'organizations.list.title': 'Vos organisations',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Échec de la dissociation du dernier compte','api-errors.ACCOUNT_NOT_FOUND': 'Compte introuvable','api-errors.USER_ALREADY_HAS_PASSWORD': 'L\'utilisateur a déjà un mot de passe',+ 'api-errors.INVALID_CODE': 'Le code fourni est invalide ou a expiré',+ 'api-errors.OTP_NOT_ENABLED': 'L\'authentification à deux facteurs n\'est pas activée pour ce compte',+ 'api-errors.OTP_HAS_EXPIRED': 'Le code d\'authentification à deux facteurs a expiré',+ 'api-errors.TOTP_NOT_ENABLED': 'Le TOTP n\'est pas activé pour ce compte',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'L\'authentification à deux facteurs n\'est pas activée pour ce compte',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Les codes de secours ne sont pas activés pour ce compte',+ 'api-errors.INVALID_BACKUP_CODE': 'Le code de secours fourni est invalide ou a déjà été utilisé',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Trop de tentatives. Veuillez demander un nouveau code.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie d\'authentification à deux facteurs invalide',// Not founddiff --git a/apps/papra-client/src/locales/it.dictionary.ts b/apps/papra-client/src/locales/it.dictionary.tsindex 14f50655..427743ca 100644--- a/apps/papra-client/src/locales/it.dictionary.ts+++ b/apps/papra-client/src/locales/it.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Password dimenticata?','auth.login.form.submit': 'Accedi',+ 'auth.login.two-factor.title': 'Verifica a due fattori',+ 'auth.login.two-factor.description.totp': 'Inserisci il codice di verifica a 6 cifre dalla tua app di autenticazione.',+ 'auth.login.two-factor.description.backup-code': 'Inserisci uno dei tuoi codici di backup per accedere al tuo account.',+ 'auth.login.two-factor.code.label.totp': 'Codice di autenticazione',+ 'auth.login.two-factor.code.label.backup-code': 'Codice di backup',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Inserisci il codice di backup',+ 'auth.login.two-factor.code.required': 'Inserisci il codice di verifica',+ 'auth.login.two-factor.trust-device.label': 'Considera attendibile questo dispositivo per 30 giorni',+ 'auth.login.two-factor.back': 'Torna al login',+ 'auth.login.two-factor.submit': 'Verifica',+ 'auth.login.two-factor.verification-failed': 'Verifica fallita. Controlla il tuo codice e riprova.',+ 'auth.login.two-factor.use-backup-code': 'Usa il codice di backup',+ 'auth.login.two-factor.use-totp': 'Usa l\'app di autenticazione',+'auth.register.title': 'Registrati a Papra','auth.register.description': 'Crea un account per iniziare a usare Papra.','auth.register.register-with-email': 'Registrati tramite email',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Esci dal tuo account. Potrai accedere nuovamente in seguito.','user.settings.logout.button': 'Esci',+ 'user.settings.two-factor.title': 'Autenticazione a due fattori',+ 'user.settings.two-factor.description': 'Aggiungi un ulteriore livello di sicurezza al tuo account.',+ 'user.settings.two-factor.status.enabled': 'Attivata',+ 'user.settings.two-factor.status.disabled': 'Disattivata',+ 'user.settings.two-factor.enable-button': 'Attiva A2F',+ 'user.settings.two-factor.disable-button': 'Disattiva A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Rigenera codici di backup',++ 'user.settings.two-factor.enable-dialog.title': 'Attiva autenticazione a due fattori',+ 'user.settings.two-factor.enable-dialog.description': 'Inserisci la tua password per attivare l\'A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Password',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Inserisci la tua password',+ 'user.settings.two-factor.enable-dialog.password.required': 'Inserisci la tua password',+ 'user.settings.two-factor.enable-dialog.cancel': 'Annulla',+ 'user.settings.two-factor.enable-dialog.submit': 'Continua',++ 'user.settings.two-factor.setup-dialog.title': 'Configura autenticazione a due fattori',+ 'user.settings.two-factor.setup-dialog.description': 'Scansiona questo codice QR con la tua app di autenticazione, poi inserisci il codice di verifica.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Caricamento codice QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Passo 1: Scansiona il codice QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scansiona il codice QR qui sotto o inserisci manualmente la chiave di configurazione nella tua app di autenticazione.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copia chiave di configurazione',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Passo 2: Verifica il codice',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Inserisci il codice a 6 cifre generato dalla tua app di autenticazione per verificare e attivare l\'autenticazione a due fattori.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Codice di verifica',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Inserisci il codice a 6 cifre',+ 'user.settings.two-factor.setup-dialog.code.required': 'Inserisci il codice di verifica',+ 'user.settings.two-factor.setup-dialog.cancel': 'Annulla',+ 'user.settings.two-factor.setup-dialog.verify': 'Verifica e attiva A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Codici di backup',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Salva questi codici di backup in un luogo sicuro. Puoi usarli per accedere al tuo account se perdi l\'accesso alla tua app di autenticazione.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Ogni codice può essere usato solo una volta.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copia codici di backup',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Scarica codici di backup',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Codici copiati negli appunti',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Ho salvato i miei codici',++ 'user.settings.two-factor.disable-dialog.title': 'Disattiva autenticazione a due fattori',+ 'user.settings.two-factor.disable-dialog.description': 'Inserisci la tua password per disattivare l\'A2F. Questo renderà il tuo account meno sicuro.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Password',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Inserisci la tua password',+ 'user.settings.two-factor.disable-dialog.password.required': 'Inserisci la tua password',+ 'user.settings.two-factor.disable-dialog.cancel': 'Annulla',+ 'user.settings.two-factor.disable-dialog.submit': 'Disattiva A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Rigenera codici di backup',+ 'user.settings.two-factor.regenerate-dialog.description': 'Questo invaliderà tutti i codici di backup esistenti e ne genererà di nuovi. Inserisci la tua password per continuare.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Password',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Inserisci la tua password',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Inserisci la tua password',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Annulla',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Rigenera codici',++ 'user.settings.two-factor.enabled': 'L\'autenticazione a due fattori è stata attivata',+ 'user.settings.two-factor.disabled': 'L\'autenticazione a due fattori è stata disattivata',+ 'user.settings.two-factor.codes-regenerated': 'I codici di backup sono stati rigenerati',+ 'user.settings.two-factor.verification-failed': 'Verifica fallita. Controlla il tuo codice e riprova.',+// Organizations'organizations.list.title': 'Le tue organizzazioni',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Impossibile scollegare l\'ultimo account','api-errors.ACCOUNT_NOT_FOUND': 'Account non trovato','api-errors.USER_ALREADY_HAS_PASSWORD': 'L\'utente ha già una password',+ 'api-errors.INVALID_CODE': 'Il codice fornito non è valido o è scaduto',+ 'api-errors.OTP_NOT_ENABLED': 'L\'autenticazione a due fattori non è attivata per questo account',+ 'api-errors.OTP_HAS_EXPIRED': 'Il codice di autenticazione a due fattori è scaduto',+ 'api-errors.TOTP_NOT_ENABLED': 'Il TOTP non è attivato per questo account',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'L\'autenticazione a due fattori non è attivata per questo account',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'I codici di backup non sono attivati per questo account',+ 'api-errors.INVALID_BACKUP_CODE': 'Il codice di backup fornito non è valido o è già stato utilizzato',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Troppi tentativi. Richiedi un nuovo codice.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie di autenticazione a due fattori non valido',// Not founddiff --git a/apps/papra-client/src/locales/nl.dictionary.ts b/apps/papra-client/src/locales/nl.dictionary.tsindex 9bf65055..f31e2d30 100644--- a/apps/papra-client/src/locales/nl.dictionary.ts+++ b/apps/papra-client/src/locales/nl.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Wachtwoord vergeten?','auth.login.form.submit': 'Inloggen',+ 'auth.login.two-factor.title': 'Twee-staps-verificatie',+ 'auth.login.two-factor.description.totp': 'Voer de 6-cijferige verificatiecode van je authenticatie-app in.',+ 'auth.login.two-factor.description.backup-code': 'Voer een van je back-upcodes in om toegang te krijgen tot je account.',+ 'auth.login.two-factor.code.label.totp': 'Authenticatiecode',+ 'auth.login.two-factor.code.label.backup-code': 'Back-upcode',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Voer back-upcode in',+ 'auth.login.two-factor.code.required': 'Voer de verificatiecode in',+ 'auth.login.two-factor.trust-device.label': 'Dit apparaat 30 dagen vertrouwen',+ 'auth.login.two-factor.back': 'Terug naar inloggen',+ 'auth.login.two-factor.submit': 'Verifiëren',+ 'auth.login.two-factor.verification-failed': 'Verificatie mislukt. Controleer je code en probeer het opnieuw.',+ 'auth.login.two-factor.use-backup-code': 'Gebruik in plaats daarvan een back-upcode',+ 'auth.login.two-factor.use-totp': 'Gebruik in plaats daarvan de authenticatie-app',+'auth.register.title': 'Registreren bij Papra','auth.register.description': 'Maak een account aan om Papra te gebruiken.','auth.register.register-with-email': 'Registreren met e-mail',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Log uit van uw account. U kunt later weer inloggen.','user.settings.logout.button': 'Uitloggen',+ 'user.settings.two-factor.title': 'Twee-factor-authenticatie',+ 'user.settings.two-factor.description': 'Voeg een extra beveiligingslaag toe aan je account.',+ 'user.settings.two-factor.status.enabled': 'Ingeschakeld',+ 'user.settings.two-factor.status.disabled': 'Uitgeschakeld',+ 'user.settings.two-factor.enable-button': '2FA inschakelen',+ 'user.settings.two-factor.disable-button': '2FA uitschakelen',+ 'user.settings.two-factor.regenerate-codes-button': 'Back-upcodes opnieuw genereren',++ 'user.settings.two-factor.enable-dialog.title': 'Twee-factor-authenticatie inschakelen',+ 'user.settings.two-factor.enable-dialog.description': 'Voer je wachtwoord in om 2FA in te schakelen.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Wachtwoord',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Voer je wachtwoord in',+ 'user.settings.two-factor.enable-dialog.password.required': 'Voer je wachtwoord in',+ 'user.settings.two-factor.enable-dialog.cancel': 'Annuleren',+ 'user.settings.two-factor.enable-dialog.submit': 'Doorgaan',++ 'user.settings.two-factor.setup-dialog.title': 'Twee-factor-authenticatie instellen',+ 'user.settings.two-factor.setup-dialog.description': 'Scan deze QR-code met je authenticatie-app en voer vervolgens de verificatiecode in.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'QR-code laden...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Stap 1: Scan de QR-code',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scan de onderstaande QR-code of voer de instellingssleutel handmatig in je authenticatie-app in.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Instellingssleutel kopiëren',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Stap 2: Verifieer de code',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Voer de 6-cijferige code in die door je authenticatie-app is gegenereerd om twee-factor-authenticatie te verifiëren en in te schakelen.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Verificatiecode',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Voer de 6-cijferige code in',+ 'user.settings.two-factor.setup-dialog.code.required': 'Voer de verificatiecode in',+ 'user.settings.two-factor.setup-dialog.cancel': 'Annuleren',+ 'user.settings.two-factor.setup-dialog.verify': 'Verifiëren en 2FA inschakelen',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Back-upcodes',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Bewaar deze back-upcodes op een veilige plaats. Je kunt ze gebruiken om toegang te krijgen tot je account als je de toegang tot je authenticatie-app verliest.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Elke code kan slechts één keer worden gebruikt.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Back-upcodes kopiëren',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Back-upcodes downloaden',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Codes gekopieerd naar klembord',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Ik heb mijn codes opgeslagen',++ 'user.settings.two-factor.disable-dialog.title': 'Twee-factor-authenticatie uitschakelen',+ 'user.settings.two-factor.disable-dialog.description': 'Voer je wachtwoord in om 2FA uit te schakelen. Dit maakt je account minder veilig.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Wachtwoord',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Voer je wachtwoord in',+ 'user.settings.two-factor.disable-dialog.password.required': 'Voer je wachtwoord in',+ 'user.settings.two-factor.disable-dialog.cancel': 'Annuleren',+ 'user.settings.two-factor.disable-dialog.submit': '2FA uitschakelen',++ 'user.settings.two-factor.regenerate-dialog.title': 'Back-upcodes opnieuw genereren',+ 'user.settings.two-factor.regenerate-dialog.description': 'Dit zal alle bestaande back-upcodes ongeldig maken en nieuwe genereren. Voer je wachtwoord in om door te gaan.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Wachtwoord',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Voer je wachtwoord in',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Voer je wachtwoord in',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Annuleren',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Codes opnieuw genereren',++ 'user.settings.two-factor.enabled': 'Twee-factor-authenticatie is ingeschakeld',+ 'user.settings.two-factor.disabled': 'Twee-factor-authenticatie is uitgeschakeld',+ 'user.settings.two-factor.codes-regenerated': 'Back-upcodes zijn opnieuw gegenereerd',+ 'user.settings.two-factor.verification-failed': 'Verificatie mislukt. Controleer je code en probeer het opnieuw.',+// Organizations'organizations.list.title': 'Uw organisaties',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Kan laatste account niet loskoppelen','api-errors.ACCOUNT_NOT_FOUND': 'Account niet gevonden','api-errors.USER_ALREADY_HAS_PASSWORD': 'Gebruiker heeft al een wachtwoord',+ 'api-errors.INVALID_CODE': 'De opgegeven code is ongeldig of verlopen',+ 'api-errors.OTP_NOT_ENABLED': 'Twee-factor-authenticatie is niet ingeschakeld voor dit account',+ 'api-errors.OTP_HAS_EXPIRED': 'De twee-factor-authenticatiecode is verlopen',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP is niet ingeschakeld voor dit account',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'Twee-factor-authenticatie is niet ingeschakeld voor dit account',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Back-upcodes zijn niet ingeschakeld voor dit account',+ 'api-errors.INVALID_BACKUP_CODE': 'De opgegeven back-upcode is ongeldig of is al gebruikt',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Te veel pogingen. Vraag een nieuwe code aan.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Ongeldige twee-factor-cookie',// Not founddiff --git a/apps/papra-client/src/locales/pl.dictionary.ts b/apps/papra-client/src/locales/pl.dictionary.tsindex 93ef55d3..8bd9d0f1 100644--- a/apps/papra-client/src/locales/pl.dictionary.ts+++ b/apps/papra-client/src/locales/pl.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Zapomniałeś hasła?','auth.login.form.submit': 'Zaloguj się',+ 'auth.login.two-factor.title': 'Weryfikacja dwuskładnikowa',+ 'auth.login.two-factor.description.totp': 'Wprowadź 6-cyfrowy kod weryfikacyjny z aplikacji uwierzytelniającej.',+ 'auth.login.two-factor.description.backup-code': 'Wprowadź jeden z kodów zapasowych, aby uzyskać dostęp do konta.',+ 'auth.login.two-factor.code.label.totp': 'Kod uwierzytelniający',+ 'auth.login.two-factor.code.label.backup-code': 'Kod zapasowy',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Wprowadź kod zapasowy',+ 'auth.login.two-factor.code.required': 'Wprowadź kod weryfikacyjny',+ 'auth.login.two-factor.trust-device.label': 'Zaufaj temu urządzeniu przez 30 dni',+ 'auth.login.two-factor.back': 'Powrót do logowania',+ 'auth.login.two-factor.submit': 'Weryfikuj',+ 'auth.login.two-factor.verification-failed': 'Weryfikacja nie powiodła się. Sprawdź kod i spróbuj ponownie.',+ 'auth.login.two-factor.use-backup-code': 'Użyj kodu zapasowego',+ 'auth.login.two-factor.use-totp': 'Użyj aplikacji uwierzytelniającej',+'auth.register.title': 'Zarejestruj się w Papra','auth.register.description': 'Utwórz konto, aby zacząć korzystać z Papra.','auth.register.register-with-email': 'Zarejestruj się przez e-mail',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Wyloguj się ze swojego konta. Możesz zalogować się ponownie później.','user.settings.logout.button': 'Wyloguj się',+ 'user.settings.two-factor.title': 'Uwierzytelnianie dwuskładnikowe',+ 'user.settings.two-factor.description': 'Dodaj dodatkową warstwę zabezpieczeń do swojego konta.',+ 'user.settings.two-factor.status.enabled': 'Włączone',+ 'user.settings.two-factor.status.disabled': 'Wyłączone',+ 'user.settings.two-factor.enable-button': 'Włącz 2FA',+ 'user.settings.two-factor.disable-button': 'Wyłącz 2FA',+ 'user.settings.two-factor.regenerate-codes-button': 'Wygeneruj ponownie kody zapasowe',++ 'user.settings.two-factor.enable-dialog.title': 'Włącz uwierzytelnianie dwuskładnikowe',+ 'user.settings.two-factor.enable-dialog.description': 'Wprowadź hasło, aby włączyć 2FA.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Hasło',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Wprowadź hasło',+ 'user.settings.two-factor.enable-dialog.password.required': 'Wprowadź hasło',+ 'user.settings.two-factor.enable-dialog.cancel': 'Anuluj',+ 'user.settings.two-factor.enable-dialog.submit': 'Kontynuuj',++ 'user.settings.two-factor.setup-dialog.title': 'Skonfiguruj uwierzytelnianie dwuskładnikowe',+ 'user.settings.two-factor.setup-dialog.description': 'Zeskanuj ten kod QR za pomocą aplikacji uwierzytelniającej, a następnie wprowadź kod weryfikacyjny.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Ładowanie kodu QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Krok 1: Zeskanuj kod QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Zeskanuj poniższy kod QR lub wprowadź ręcznie klucz konfiguracyjny do aplikacji uwierzytelniającej.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Skopiuj klucz konfiguracyjny',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Krok 2: Zweryfikuj kod',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Wprowadź 6-cyfrowy kod wygenerowany przez aplikację uwierzytelniającą, aby zweryfikować i włączyć uwierzytelnianie dwuskładnikowe.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Kod weryfikacyjny',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Wprowadź 6-cyfrowy kod',+ 'user.settings.two-factor.setup-dialog.code.required': 'Wprowadź kod weryfikacyjny',+ 'user.settings.two-factor.setup-dialog.cancel': 'Anuluj',+ 'user.settings.two-factor.setup-dialog.verify': 'Weryfikuj i włącz 2FA',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Kody zapasowe',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Zapisz te kody zapasowe w bezpiecznym miejscu. Możesz ich użyć do uzyskania dostępu do konta, jeśli stracisz dostęp do aplikacji uwierzytelniającej.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Każdy kod może być użyty tylko raz.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Skopiuj kody zapasowe',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Pobierz kody zapasowe',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Kody skopiowane do schowka',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Zapisałem moje kody',++ 'user.settings.two-factor.disable-dialog.title': 'Wyłącz uwierzytelnianie dwuskładnikowe',+ 'user.settings.two-factor.disable-dialog.description': 'Wprowadź hasło, aby wyłączyć 2FA. Spowoduje to zmniejszenie bezpieczeństwa konta.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Hasło',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Wprowadź hasło',+ 'user.settings.two-factor.disable-dialog.password.required': 'Wprowadź hasło',+ 'user.settings.two-factor.disable-dialog.cancel': 'Anuluj',+ 'user.settings.two-factor.disable-dialog.submit': 'Wyłącz 2FA',++ 'user.settings.two-factor.regenerate-dialog.title': 'Wygeneruj ponownie kody zapasowe',+ 'user.settings.two-factor.regenerate-dialog.description': 'Spowoduje to unieważnienie wszystkich istniejących kodów zapasowych i wygenerowanie nowych. Wprowadź hasło, aby kontynuować.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Hasło',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Wprowadź hasło',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Wprowadź hasło',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Anuluj',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Wygeneruj ponownie kody',++ 'user.settings.two-factor.enabled': 'Uwierzytelnianie dwuskładnikowe zostało włączone',+ 'user.settings.two-factor.disabled': 'Uwierzytelnianie dwuskładnikowe zostało wyłączone',+ 'user.settings.two-factor.codes-regenerated': 'Kody zapasowe zostały wygenerowane ponownie',+ 'user.settings.two-factor.verification-failed': 'Weryfikacja nie powiodła się. Sprawdź kod i spróbuj ponownie.',+// Organizations'organizations.list.title': 'Twoje organizacje',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Nie udało się odłączyć ostatniego konta','api-errors.ACCOUNT_NOT_FOUND': 'Nie znaleziono konta','api-errors.USER_ALREADY_HAS_PASSWORD': 'Użytkownik ma już hasło',+ 'api-errors.INVALID_CODE': 'Podany kod jest nieprawidłowy lub wygasł',+ 'api-errors.OTP_NOT_ENABLED': 'Uwierzytelnianie dwuskładnikowe nie jest włączone dla tego konta',+ 'api-errors.OTP_HAS_EXPIRED': 'Kod uwierzytelniania dwuskładnikowego wygasł',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP nie jest włączone dla tego konta',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'Uwierzytelnianie dwuskładnikowe nie jest włączone dla tego konta',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Kody zapasowe nie są włączone dla tego konta',+ 'api-errors.INVALID_BACKUP_CODE': 'Podany kod zapasowy jest nieprawidłowy lub został już użyty',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Zbyt wiele prób. Poproś o nowy kod.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Nieprawidłowy plik cookie uwierzytelniania dwuskładnikowego',// Not founddiff --git a/apps/papra-client/src/locales/pt-BR.dictionary.ts b/apps/papra-client/src/locales/pt-BR.dictionary.tsindex 6de0e26d..32a5235a 100644--- a/apps/papra-client/src/locales/pt-BR.dictionary.ts+++ b/apps/papra-client/src/locales/pt-BR.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Esqueceu a senha?','auth.login.form.submit': 'Entrar',+ 'auth.login.two-factor.title': 'Verificação em duas etapas',+ 'auth.login.two-factor.description.totp': 'Digite o código de verificação de 6 dígitos do seu aplicativo autenticador.',+ 'auth.login.two-factor.description.backup-code': 'Digite um dos seus códigos de backup para acessar sua conta.',+ 'auth.login.two-factor.code.label.totp': 'Código de autenticação',+ 'auth.login.two-factor.code.label.backup-code': 'Código de backup',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Digite o código de backup',+ 'auth.login.two-factor.code.required': 'Por favor, digite o código de verificação',+ 'auth.login.two-factor.trust-device.label': 'Confiar neste dispositivo por 30 dias',+ 'auth.login.two-factor.back': 'Voltar ao login',+ 'auth.login.two-factor.submit': 'Verificar',+ 'auth.login.two-factor.verification-failed': 'Falha na verificação. Verifique seu código e tente novamente.',+ 'auth.login.two-factor.use-backup-code': 'Usar código de backup',+ 'auth.login.two-factor.use-totp': 'Usar aplicativo autenticador',+'auth.register.title': 'Cadastre-se no Papra','auth.register.description': 'Crie uma conta para começar a usar o Papra.','auth.register.register-with-email': 'Cadastrar com e-mail',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Encerre a sessão da sua conta. Você poderá acessá-la novamente mais tarde.','user.settings.logout.button': 'Sair',+ 'user.settings.two-factor.title': 'Autenticação de dois fatores',+ 'user.settings.two-factor.description': 'Adicione uma camada extra de segurança à sua conta.',+ 'user.settings.two-factor.status.enabled': 'Ativada',+ 'user.settings.two-factor.status.disabled': 'Desativada',+ 'user.settings.two-factor.enable-button': 'Ativar A2F',+ 'user.settings.two-factor.disable-button': 'Desativar A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Gerar novos códigos de backup',++ 'user.settings.two-factor.enable-dialog.title': 'Ativar autenticação de dois fatores',+ 'user.settings.two-factor.enable-dialog.description': 'Digite sua senha para ativar A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Senha',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Digite sua senha',+ 'user.settings.two-factor.enable-dialog.password.required': 'Por favor, digite sua senha',+ 'user.settings.two-factor.enable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.enable-dialog.submit': 'Continuar',++ 'user.settings.two-factor.setup-dialog.title': 'Configurar autenticação de dois fatores',+ 'user.settings.two-factor.setup-dialog.description': 'Escaneie este código QR com seu aplicativo autenticador e depois digite o código de verificação.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Carregando código QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Passo 1: Escanear o código QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Escaneie o código QR abaixo ou digite manualmente a chave de configuração em seu aplicativo autenticador.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copiar chave de configuração',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Passo 2: Verificar o código',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Digite o código de 6 dígitos gerado pelo seu aplicativo autenticador para verificar e ativar a autenticação de dois fatores.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Código de verificação',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Digite o código de 6 dígitos',+ 'user.settings.two-factor.setup-dialog.code.required': 'Por favor, digite o código de verificação',+ 'user.settings.two-factor.setup-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.setup-dialog.verify': 'Verificar e ativar A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Códigos de backup',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Salve estes códigos de backup em um local seguro. Você pode usá-los para acessar sua conta se perder o acesso ao seu aplicativo autenticador.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Cada código só pode ser usado uma vez.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copiar códigos de backup',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Baixar códigos de backup',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Códigos copiados para a área de transferência',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Salvei meus códigos',++ 'user.settings.two-factor.disable-dialog.title': 'Desativar autenticação de dois fatores',+ 'user.settings.two-factor.disable-dialog.description': 'Digite sua senha para desativar A2F. Isso tornará sua conta menos segura.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Senha',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Digite sua senha',+ 'user.settings.two-factor.disable-dialog.password.required': 'Por favor, digite sua senha',+ 'user.settings.two-factor.disable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.disable-dialog.submit': 'Desativar A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Gerar novos códigos de backup',+ 'user.settings.two-factor.regenerate-dialog.description': 'Isso invalidará todos os códigos de backup existentes e gerará novos. Digite sua senha para continuar.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Senha',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Digite sua senha',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Por favor, digite sua senha',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Gerar novos códigos',++ 'user.settings.two-factor.enabled': 'A autenticação de dois fatores foi ativada',+ 'user.settings.two-factor.disabled': 'A autenticação de dois fatores foi desativada',+ 'user.settings.two-factor.codes-regenerated': 'Os códigos de backup foram gerados novamente',+ 'user.settings.two-factor.verification-failed': 'Falha na verificação. Verifique seu código e tente novamente.',+// Organizations'organizations.list.title': 'Suas organizações',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Falha ao desvincular a última conta','api-errors.ACCOUNT_NOT_FOUND': 'Conta não encontrada','api-errors.USER_ALREADY_HAS_PASSWORD': 'O usuário já possui uma senha',+ 'api-errors.INVALID_CODE': 'O código fornecido é inválido ou expirou',+ 'api-errors.OTP_NOT_ENABLED': 'A autenticação de dois fatores não está ativada para esta conta',+ 'api-errors.OTP_HAS_EXPIRED': 'O código de autenticação de dois fatores expirou',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP não está ativado para esta conta',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'A autenticação de dois fatores não está ativada para esta conta',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Os códigos de backup não estão ativados para esta conta',+ 'api-errors.INVALID_BACKUP_CODE': 'O código de backup fornecido é inválido ou já foi usado',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Muitas tentativas. Por favor, solicite um novo código.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie de autenticação de dois fatores inválido',// Not founddiff --git a/apps/papra-client/src/locales/pt.dictionary.ts b/apps/papra-client/src/locales/pt.dictionary.tsindex 559bd185..c323e06b 100644--- a/apps/papra-client/src/locales/pt.dictionary.ts+++ b/apps/papra-client/src/locales/pt.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Esqueceu-se da palavra-passe?','auth.login.form.submit': 'Iniciar sessão',+ 'auth.login.two-factor.title': 'Verificação em dois passos',+ 'auth.login.two-factor.description.totp': 'Introduza o código de verificação de 6 dígitos da sua aplicação de autenticação.',+ 'auth.login.two-factor.description.backup-code': 'Introduza um dos seus códigos de segurança para aceder à sua conta.',+ 'auth.login.two-factor.code.label.totp': 'Código de autenticação',+ 'auth.login.two-factor.code.label.backup-code': 'Código de segurança',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Introduza o código de segurança',+ 'auth.login.two-factor.code.required': 'Por favor, introduza o código de verificação',+ 'auth.login.two-factor.trust-device.label': 'Confiar neste dispositivo durante 30 dias',+ 'auth.login.two-factor.back': 'Voltar ao início de sessão',+ 'auth.login.two-factor.submit': 'Verificar',+ 'auth.login.two-factor.verification-failed': 'Falha na verificação. Verifique o seu código e tente novamente.',+ 'auth.login.two-factor.use-backup-code': 'Usar código de segurança',+ 'auth.login.two-factor.use-totp': 'Usar aplicação de autenticação',+'auth.register.title': 'Registar no Papra','auth.register.description': 'Crie uma conta para começar a usar o Papra.','auth.register.register-with-email': 'Registar com e-mail',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Terminar sessão da sua conta. Pode iniciar sessão novamente mais tarde.','user.settings.logout.button': 'Terminar sessão',+ 'user.settings.two-factor.title': 'Autenticação de dois fatores',+ 'user.settings.two-factor.description': 'Adicione uma camada extra de segurança à sua conta.',+ 'user.settings.two-factor.status.enabled': 'Ativada',+ 'user.settings.two-factor.status.disabled': 'Desativada',+ 'user.settings.two-factor.enable-button': 'Ativar A2F',+ 'user.settings.two-factor.disable-button': 'Desativar A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Regenerar códigos de segurança',++ 'user.settings.two-factor.enable-dialog.title': 'Ativar autenticação de dois fatores',+ 'user.settings.two-factor.enable-dialog.description': 'Introduza a sua palavra-passe para ativar A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Palavra-passe',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Introduza a sua palavra-passe',+ 'user.settings.two-factor.enable-dialog.password.required': 'Por favor, introduza a sua palavra-passe',+ 'user.settings.two-factor.enable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.enable-dialog.submit': 'Continuar',++ 'user.settings.two-factor.setup-dialog.title': 'Configurar autenticação de dois fatores',+ 'user.settings.two-factor.setup-dialog.description': 'Digitalize este código QR com a sua aplicação de autenticação e depois introduza o código de verificação.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'A carregar código QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Passo 1: Digitalizar o código QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Digitalize o código QR abaixo ou introduza manualmente a chave de configuração na sua aplicação de autenticação.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copiar chave de configuração',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Passo 2: Verificar o código',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Introduza o código de 6 dígitos gerado pela sua aplicação de autenticação para verificar e ativar a autenticação de dois fatores.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Código de verificação',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Introduza o código de 6 dígitos',+ 'user.settings.two-factor.setup-dialog.code.required': 'Por favor, introduza o código de verificação',+ 'user.settings.two-factor.setup-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.setup-dialog.verify': 'Verificar e ativar A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Códigos de segurança',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Guarde estes códigos de segurança num local seguro. Pode usá-los para aceder à sua conta se perder o acesso à sua aplicação de autenticação.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Cada código só pode ser usado uma vez.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copiar códigos de segurança',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Transferir códigos de segurança',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Códigos copiados para a área de transferência',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Guardei os meus códigos',++ 'user.settings.two-factor.disable-dialog.title': 'Desativar autenticação de dois fatores',+ 'user.settings.two-factor.disable-dialog.description': 'Introduza a sua palavra-passe para desativar A2F. Isto tornará a sua conta menos segura.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Palavra-passe',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Introduza a sua palavra-passe',+ 'user.settings.two-factor.disable-dialog.password.required': 'Por favor, introduza a sua palavra-passe',+ 'user.settings.two-factor.disable-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.disable-dialog.submit': 'Desativar A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Regenerar códigos de segurança',+ 'user.settings.two-factor.regenerate-dialog.description': 'Isto invalidará todos os códigos de segurança existentes e gerará novos. Introduza a sua palavra-passe para continuar.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Palavra-passe',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Introduza a sua palavra-passe',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Por favor, introduza a sua palavra-passe',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Cancelar',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Regenerar códigos',++ 'user.settings.two-factor.enabled': 'A autenticação de dois fatores foi ativada',+ 'user.settings.two-factor.disabled': 'A autenticação de dois fatores foi desativada',+ 'user.settings.two-factor.codes-regenerated': 'Os códigos de segurança foram regenerados',+ 'user.settings.two-factor.verification-failed': 'Falha na verificação. Verifique o seu código e tente novamente.',+// Organizations'organizations.list.title': 'As suas organizações',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Falha ao desassociar a última conta','api-errors.ACCOUNT_NOT_FOUND': 'Conta não encontrada','api-errors.USER_ALREADY_HAS_PASSWORD': 'O utilizador já tem uma palavra-passe',+ 'api-errors.INVALID_CODE': 'O código fornecido é inválido ou expirou',+ 'api-errors.OTP_NOT_ENABLED': 'A autenticação de dois fatores não está ativada para esta conta',+ 'api-errors.OTP_HAS_EXPIRED': 'O código de autenticação de dois fatores expirou',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP não está ativado para esta conta',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'A autenticação de dois fatores não está ativada para esta conta',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Os códigos de segurança não estão ativados para esta conta',+ 'api-errors.INVALID_BACKUP_CODE': 'O código de segurança fornecido é inválido ou já foi usado',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Demasiadas tentativas. Por favor, solicite um novo código.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie de autenticação de dois fatores inválido',// Not founddiff --git a/apps/papra-client/src/locales/ro.dictionary.ts b/apps/papra-client/src/locales/ro.dictionary.tsindex f9855031..bc517be7 100644--- a/apps/papra-client/src/locales/ro.dictionary.ts+++ b/apps/papra-client/src/locales/ro.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': 'Ai uitat parola?','auth.login.form.submit': 'Autentificare',+ 'auth.login.two-factor.title': 'Verificare în doi pași',+ 'auth.login.two-factor.description.totp': 'Introduceți codul de verificare de 6 cifre din aplicația dvs. de autentificare.',+ 'auth.login.two-factor.description.backup-code': 'Introduceți unul dintre codurile dvs. de rezervă pentru a accesa contul.',+ 'auth.login.two-factor.code.label.totp': 'Cod de autentificare',+ 'auth.login.two-factor.code.label.backup-code': 'Cod de rezervă',+ 'auth.login.two-factor.code.placeholder.backup-code': 'Introduceți codul de rezervă',+ 'auth.login.two-factor.code.required': 'Vă rugăm să introduceți codul de verificare',+ 'auth.login.two-factor.trust-device.label': 'Acordă încredere acestui dispozitiv pentru 30 de zile',+ 'auth.login.two-factor.back': 'Înapoi la autentificare',+ 'auth.login.two-factor.submit': 'Verifică',+ 'auth.login.two-factor.verification-failed': 'Verificare eșuată. Verificați codul și încercați din nou.',+ 'auth.login.two-factor.use-backup-code': 'Folosește cod de rezervă',+ 'auth.login.two-factor.use-totp': 'Folosește aplicația de autentificare',+'auth.register.title': 'Înregistrare la Papra','auth.register.description': 'Introdu e-mailul pentru a accesa Papra.','auth.register.register-with-email': 'înregistrează-te cu e-mail',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': 'Vei fi deconectat din cont. Te poți conecta înapoi ulterior.','user.settings.logout.button': 'Deconectare',+ 'user.settings.two-factor.title': 'Autentificare cu doi factori',+ 'user.settings.two-factor.description': 'Adăugați un nivel suplimentar de securitate contului dvs.',+ 'user.settings.two-factor.status.enabled': 'Activată',+ 'user.settings.two-factor.status.disabled': 'Dezactivată',+ 'user.settings.two-factor.enable-button': 'Activează A2F',+ 'user.settings.two-factor.disable-button': 'Dezactivează A2F',+ 'user.settings.two-factor.regenerate-codes-button': 'Regenerează codurile de rezervă',++ 'user.settings.two-factor.enable-dialog.title': 'Activare autentificare cu doi factori',+ 'user.settings.two-factor.enable-dialog.description': 'Introduceți parola pentru a activa A2F.',+ 'user.settings.two-factor.enable-dialog.password.label': 'Parolă',+ 'user.settings.two-factor.enable-dialog.password.placeholder': 'Introduceți parola',+ 'user.settings.two-factor.enable-dialog.password.required': 'Vă rugăm să introduceți parola',+ 'user.settings.two-factor.enable-dialog.cancel': 'Anulează',+ 'user.settings.two-factor.enable-dialog.submit': 'Continuă',++ 'user.settings.two-factor.setup-dialog.title': 'Configurare autentificare cu doi factori',+ 'user.settings.two-factor.setup-dialog.description': 'Scanați acest cod QR cu aplicația dvs. de autentificare, apoi introduceți codul de verificare.',+ 'user.settings.two-factor.setup-dialog.qr-loading': 'Se încarcă codul QR...',+ 'user.settings.two-factor.setup-dialog.step1.title': 'Pasul 1: Scanați codul QR',+ 'user.settings.two-factor.setup-dialog.step1.description': 'Scanați codul QR de mai jos sau introduceți manual cheia de configurare în aplicația dvs. de autentificare.',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': 'Copiază cheia de configurare',+ 'user.settings.two-factor.setup-dialog.step2.title': 'Pasul 2: Verificați codul',+ 'user.settings.two-factor.setup-dialog.step2.description': 'Introduceți codul de 6 cifre generat de aplicația dvs. de autentificare pentru a verifica și activa autentificarea cu doi factori.',+ 'user.settings.two-factor.setup-dialog.code.label': 'Cod de verificare',+ 'user.settings.two-factor.setup-dialog.code.placeholder': 'Introduceți codul de 6 cifre',+ 'user.settings.two-factor.setup-dialog.code.required': 'Vă rugăm să introduceți codul de verificare',+ 'user.settings.two-factor.setup-dialog.cancel': 'Anulează',+ 'user.settings.two-factor.setup-dialog.verify': 'Verifică și activează A2F',++ 'user.settings.two-factor.backup-codes-dialog.title': 'Coduri de rezervă',+ 'user.settings.two-factor.backup-codes-dialog.description': 'Salvați aceste coduri de rezervă într-un loc sigur. Le puteți folosi pentru a accesa contul dacă pierdeți accesul la aplicația dvs. de autentificare.',+ 'user.settings.two-factor.backup-codes-dialog.warning': 'Fiecare cod poate fi folosit o singură dată.',+ 'user.settings.two-factor.backup-codes-dialog.copy': 'Copiază codurile de rezervă',+ 'user.settings.two-factor.backup-codes-dialog.download': 'Descarcă codurile de rezervă',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': 'Coduri copiate în clipboard',+ 'user.settings.two-factor.backup-codes-dialog.close': 'Am salvat codurile',++ 'user.settings.two-factor.disable-dialog.title': 'Dezactivare autentificare cu doi factori',+ 'user.settings.two-factor.disable-dialog.description': 'Introduceți parola pentru a dezactiva A2F. Aceasta va face contul dvs. mai puțin sigur.',+ 'user.settings.two-factor.disable-dialog.password.label': 'Parolă',+ 'user.settings.two-factor.disable-dialog.password.placeholder': 'Introduceți parola',+ 'user.settings.two-factor.disable-dialog.password.required': 'Vă rugăm să introduceți parola',+ 'user.settings.two-factor.disable-dialog.cancel': 'Anulează',+ 'user.settings.two-factor.disable-dialog.submit': 'Dezactivează A2F',++ 'user.settings.two-factor.regenerate-dialog.title': 'Regenerare coduri de rezervă',+ 'user.settings.two-factor.regenerate-dialog.description': 'Aceasta va invalida toate codurile de rezervă existente și va genera altele noi. Introduceți parola pentru a continua.',+ 'user.settings.two-factor.regenerate-dialog.password.label': 'Parolă',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': 'Introduceți parola',+ 'user.settings.two-factor.regenerate-dialog.password.required': 'Vă rugăm să introduceți parola',+ 'user.settings.two-factor.regenerate-dialog.cancel': 'Anulează',+ 'user.settings.two-factor.regenerate-dialog.submit': 'Regenerează codurile',++ 'user.settings.two-factor.enabled': 'Autentificarea cu doi factori a fost activată',+ 'user.settings.two-factor.disabled': 'Autentificarea cu doi factori a fost dezactivată',+ 'user.settings.two-factor.codes-regenerated': 'Codurile de rezervă au fost regenerate',+ 'user.settings.two-factor.verification-failed': 'Verificare eșuată. Verificați codul și încercați din nou.',+// Organizations'organizations.list.title': 'Organizațiile tale',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': 'Eroare la disocierea ultimului cont','api-errors.ACCOUNT_NOT_FOUND': 'Contul nu a fost găsit','api-errors.USER_ALREADY_HAS_PASSWORD': 'Utilizatorul are deja o parolă',+ 'api-errors.INVALID_CODE': 'Codul furnizat este invalid sau a expirat',+ 'api-errors.OTP_NOT_ENABLED': 'Autentificarea cu doi factori nu este activată pentru acest cont',+ 'api-errors.OTP_HAS_EXPIRED': 'Codul de autentificare cu doi factori a expirat',+ 'api-errors.TOTP_NOT_ENABLED': 'TOTP nu este activat pentru acest cont',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': 'Autentificarea cu doi factori nu este activată pentru acest cont',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': 'Codurile de rezervă nu sunt activate pentru acest cont',+ 'api-errors.INVALID_BACKUP_CODE': 'Codul de rezervă furnizat este invalid sau a fost deja folosit',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': 'Prea multe încercări. Vă rugăm să solicitați un cod nou.',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': 'Cookie de autentificare cu doi factori invalid',// Not founddiff --git a/apps/papra-client/src/locales/zh.dictionary.ts b/apps/papra-client/src/locales/zh.dictionary.tsindex 14b0a87c..fedd0b95 100644--- a/apps/papra-client/src/locales/zh.dictionary.ts+++ b/apps/papra-client/src/locales/zh.dictionary.ts@@ -42,6 +42,20 @@ export const translations: Partial<TranslationsDictionary> = {'auth.login.form.forgot-password.label': '忘记密码?','auth.login.form.submit': '登录',+ 'auth.login.two-factor.title': '两步验证',+ 'auth.login.two-factor.description.totp': '请输入身份验证应用中的6位验证码。',+ 'auth.login.two-factor.description.backup-code': '请输入您的备用码以访问账户。',+ 'auth.login.two-factor.code.label.totp': '验证码',+ 'auth.login.two-factor.code.label.backup-code': '备用码',+ 'auth.login.two-factor.code.placeholder.backup-code': '输入备用码',+ 'auth.login.two-factor.code.required': '请输入验证码',+ 'auth.login.two-factor.trust-device.label': '信任此设备30天',+ 'auth.login.two-factor.back': '返回登录',+ 'auth.login.two-factor.submit': '验证',+ 'auth.login.two-factor.verification-failed': '验证失败。请检查您的验证码后重试。',+ 'auth.login.two-factor.use-backup-code': '使用备用码',+ 'auth.login.two-factor.use-totp': '使用身份验证应用',+'auth.register.title': '注册 Papra','auth.register.description': '创建一个账户以开始使用 Papra。','auth.register.register-with-email': '使用电子邮件注册',@@ -104,6 +118,66 @@ export const translations: Partial<TranslationsDictionary> = {'user.settings.logout.description': '从您的账户登出。您可以稍后再次登录。','user.settings.logout.button': '登出',+ 'user.settings.two-factor.title': '双因素认证',+ 'user.settings.two-factor.description': '为您的账户添加额外的安全保护。',+ 'user.settings.two-factor.status.enabled': '已启用',+ 'user.settings.two-factor.status.disabled': '已禁用',+ 'user.settings.two-factor.enable-button': '启用双因素认证',+ 'user.settings.two-factor.disable-button': '禁用双因素认证',+ 'user.settings.two-factor.regenerate-codes-button': '重新生成备用码',++ 'user.settings.two-factor.enable-dialog.title': '启用双因素认证',+ 'user.settings.two-factor.enable-dialog.description': '请输入密码以启用双因素认证。',+ 'user.settings.two-factor.enable-dialog.password.label': '密码',+ 'user.settings.two-factor.enable-dialog.password.placeholder': '输入密码',+ 'user.settings.two-factor.enable-dialog.password.required': '请输入密码',+ 'user.settings.two-factor.enable-dialog.cancel': '取消',+ 'user.settings.two-factor.enable-dialog.submit': '继续',++ 'user.settings.two-factor.setup-dialog.title': '设置双因素认证',+ 'user.settings.two-factor.setup-dialog.description': '使用身份验证应用扫描此二维码,然后输入验证码。',+ 'user.settings.two-factor.setup-dialog.qr-loading': '加载二维码中...',+ 'user.settings.two-factor.setup-dialog.step1.title': '步骤1:扫描二维码',+ 'user.settings.two-factor.setup-dialog.step1.description': '扫描下方二维码或手动输入设置密钥到您的身份验证应用中。',+ 'user.settings.two-factor.setup-dialog.copy-setup-key': '复制设置密钥',+ 'user.settings.two-factor.setup-dialog.step2.title': '步骤2:验证码',+ 'user.settings.two-factor.setup-dialog.step2.description': '输入身份验证应用生成的6位验证码以验证并启用双因素认证。',+ 'user.settings.two-factor.setup-dialog.code.label': '验证码',+ 'user.settings.two-factor.setup-dialog.code.placeholder': '输入6位验证码',+ 'user.settings.two-factor.setup-dialog.code.required': '请输入验证码',+ 'user.settings.two-factor.setup-dialog.cancel': '取消',+ 'user.settings.two-factor.setup-dialog.verify': '验证并启用双因素认证',++ 'user.settings.two-factor.backup-codes-dialog.title': '备用码',+ 'user.settings.two-factor.backup-codes-dialog.description': '请将这些备用码保存在安全的地方。如果您无法访问身份验证应用,可以使用它们访问账户。',+ 'user.settings.two-factor.backup-codes-dialog.warning': '每个备用码只能使用一次。',+ 'user.settings.two-factor.backup-codes-dialog.copy': '复制备用码',+ 'user.settings.two-factor.backup-codes-dialog.download': '下载备用码',+ 'user.settings.two-factor.backup-codes-dialog.download-filename': 'papra-2fa-backup-codes.txt',+ 'user.settings.two-factor.backup-codes-dialog.copied': '备用码已复制到剪贴板',+ 'user.settings.two-factor.backup-codes-dialog.close': '我已保存备用码',++ 'user.settings.two-factor.disable-dialog.title': '禁用双因素认证',+ 'user.settings.two-factor.disable-dialog.description': '请输入密码以禁用双因素认证。这将降低您账户的安全性。',+ 'user.settings.two-factor.disable-dialog.password.label': '密码',+ 'user.settings.two-factor.disable-dialog.password.placeholder': '输入密码',+ 'user.settings.two-factor.disable-dialog.password.required': '请输入密码',+ 'user.settings.two-factor.disable-dialog.cancel': '取消',+ 'user.settings.two-factor.disable-dialog.submit': '禁用双因素认证',++ 'user.settings.two-factor.regenerate-dialog.title': '重新生成备用码',+ 'user.settings.two-factor.regenerate-dialog.description': '这将使所有现有备用码失效并生成新的备用码。请输入密码以继续。',+ 'user.settings.two-factor.regenerate-dialog.password.label': '密码',+ 'user.settings.two-factor.regenerate-dialog.password.placeholder': '输入密码',+ 'user.settings.two-factor.regenerate-dialog.password.required': '请输入密码',+ 'user.settings.two-factor.regenerate-dialog.cancel': '取消',+ 'user.settings.two-factor.regenerate-dialog.submit': '重新生成备用码',++ 'user.settings.two-factor.enabled': '双因素认证已启用',+ 'user.settings.two-factor.disabled': '双因素认证已禁用',+ 'user.settings.two-factor.codes-regenerated': '备用码已重新生成',+ 'user.settings.two-factor.verification-failed': '验证失败。请检查您的验证码后重试。',+// Organizations'organizations.list.title': '您的组织',@@ -641,6 +715,15 @@ export const translations: Partial<TranslationsDictionary> = {'api-errors.FAILED_TO_UNLINK_LAST_ACCOUNT': '无法解除最后一个账户的关联','api-errors.ACCOUNT_NOT_FOUND': '账户未找到','api-errors.USER_ALREADY_HAS_PASSWORD': '用户已设置密码',+ 'api-errors.INVALID_CODE': '提供的验证码无效或已过期',+ 'api-errors.OTP_NOT_ENABLED': '此账户未启用双因素认证',+ 'api-errors.OTP_HAS_EXPIRED': '双因素认证验证码已过期',+ 'api-errors.TOTP_NOT_ENABLED': '此账户未启用TOTP',+ 'api-errors.TWO_FACTOR_NOT_ENABLED': '此账户未启用双因素认证',+ 'api-errors.BACKUP_CODES_NOT_ENABLED': '此账户未启用备用码',+ 'api-errors.INVALID_BACKUP_CODE': '提供的备用码无效或已被使用',+ 'api-errors.TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE': '尝试次数过多。请请求新的验证码。',+ 'api-errors.INVALID_TWO_FACTOR_COOKIE': '无效的双因素认证Cookie',// Not founddiff --git a/apps/papra-client/src/modules/auth/auth.demo.services.ts b/apps/papra-client/src/modules/auth/auth.demo.services.tsindex 175dca60..4de0e529 100644--- a/apps/papra-client/src/modules/auth/auth.demo.services.ts+++ b/apps/papra-client/src/modules/auth/auth.demo.services.ts@@ -20,6 +20,15 @@ export function createDemoAuthClient() {requestPasswordReset: () => Promise.resolve({}),resetPassword: () => Promise.resolve({}),sendVerificationEmail: () => Promise.resolve({}),+ twoFactor: {+ enable: () => Promise.resolve({ data: null, error: null }),+ disable: () => Promise.resolve({ data: null, error: null }),+ getTotpUri: () => Promise.resolve({ data: null, error: null }),+ verifyTotp: () => Promise.resolve({ data: null, error: null }),+ generateBackupCodes: () => Promise.resolve({ data: null, error: null }),+ viewBackupCodes: () => Promise.resolve({ data: null, error: null }),+ verifyBackupCode: () => Promise.resolve({ data: null, error: null }),+ },};return new Proxy(baseClient, {diff --git a/apps/papra-client/src/modules/auth/auth.services.ts b/apps/papra-client/src/modules/auth/auth.services.tsindex 0f7ca98a..79f75cf5 100644--- a/apps/papra-client/src/modules/auth/auth.services.ts+++ b/apps/papra-client/src/modules/auth/auth.services.ts@@ -1,7 +1,7 @@import type { Config } from '../config/config';import type { SsoProviderConfig } from './auth.types';-import { genericOAuthClient } from 'better-auth/client/plugins';+import { genericOAuthClient, twoFactorClient } from 'better-auth/client/plugins';import { createAuthClient as createBetterAuthClient } from 'better-auth/solid';import { buildTimeConfig } from '../config/config';import { queryClient } from '../shared/query/query-client';@@ -13,6 +13,7 @@ export function createAuthClient() {baseURL: buildTimeConfig.baseApiUrl,plugins: [genericOAuthClient(),+ twoFactorClient(),],});@@ -24,6 +25,7 @@ export function createAuthClient() {resetPassword: client.resetPassword,sendVerificationEmail: client.sendVerificationEmail,useSession: client.useSession,+ twoFactor: client.twoFactor,signOut: async () => {trackingServices.capture({ event: 'User logged out' });const result = await client.signOut();@@ -44,6 +46,7 @@ export const {requestPasswordReset,resetPassword,sendVerificationEmail,+ twoFactor,} = buildTimeConfig.isDemoMode? createDemoAuthClient(): createAuthClient();diff --git a/apps/papra-client/src/modules/auth/components/verify-otp.component.tsx b/apps/papra-client/src/modules/auth/components/verify-otp.component.tsxnew file mode 100644index 00000000..f7966755--- /dev/null+++ b/apps/papra-client/src/modules/auth/components/verify-otp.component.tsx@@ -0,0 +1,33 @@+import type { Component } from 'solid-js';+import {+ OTPField,+ OTPFieldGroup,+ OTPFieldInput,+ OTPFieldSlot,+ REGEXP_ONLY_DIGITS,+} from '@/modules/ui/components/otp-field';++export const TotpField: Component<{+ onComplete?: (args: { totpCode: string }) => void;+ value?: string;+ onValueChange?: (value: string) => void;+}> = (props) => {+ return (+ <OTPField+ maxLength={6}+ onComplete={totpCode => props.onComplete?.({ totpCode })}+ value={props.value}+ onValueChange={props.onValueChange}+ >+ <OTPFieldInput pattern={REGEXP_ONLY_DIGITS} aria-label="Enter the 6-digit verification code" />+ <OTPFieldGroup>+ <OTPFieldSlot index={0} />+ <OTPFieldSlot index={1} />+ <OTPFieldSlot index={2} />+ <OTPFieldSlot index={3} />+ <OTPFieldSlot index={4} />+ <OTPFieldSlot index={5} />+ </OTPFieldGroup>+ </OTPField>+ );+};diff --git a/apps/papra-client/src/modules/auth/pages/login.page.tsx b/apps/papra-client/src/modules/auth/pages/login.page.tsxindex 35329795..661adad8 100644--- a/apps/papra-client/src/modules/auth/pages/login.page.tsx+++ b/apps/papra-client/src/modules/auth/pages/login.page.tsx@@ -2,6 +2,7 @@ import type { Component } from 'solid-js';import type { SsoProviderConfig } from '../auth.types';import { buildUrl } from '@corentinth/chisels';import { A, useNavigate } from '@solidjs/router';+import { useMutation } from '@tanstack/solid-query';import { createSignal, For, Show } from 'solid-js';import * as v from 'valibot';import { useConfig } from '@/modules/config/config.provider';@@ -11,16 +12,178 @@ import { useI18nApiErrors } from '@/modules/shared/http/composables/i18n-api-errimport { Button } from '@/modules/ui/components/button';import { Checkbox, CheckboxControl, CheckboxLabel } from '@/modules/ui/components/checkbox';import { Separator } from '@/modules/ui/components/separator';+import { createToast } from '@/modules/ui/components/sonner';import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';import { AuthLayout } from '../../ui/layouts/auth-layout.component';import { authPagesPaths } from '../auth.constants';import { getEnabledSsoProviderConfigs, isEmailVerificationRequiredError } from '../auth.models';-import { authWithProvider, signIn } from '../auth.services';+import { authWithProvider, signIn, twoFactor } from '../auth.services';import { AuthLegalLinks } from '../components/legal-links.component';import { NoAuthProviderWarning } from '../components/no-auth-provider';import { SsoProviderButton } from '../components/sso-provider-button.component';+import { TotpField } from '../components/verify-otp.component';-export const EmailLoginForm: Component = () => {+const TotpVerificationForm: Component = () => {+ const navigate = useNavigate();+ const { t } = useI18n();+ const [trustDevice, setTrustDevice] = createSignal(false);+ const [totpCode, setTotpCode] = createSignal('');++ const verifyMutation = useMutation(() => ({+ mutationFn: async ({ code, trust }: { code: string; trust: boolean }) => {+ const { error } = await twoFactor.verifyTotp({ code, trustDevice: trust });++ if (error) {+ createToast({ type: 'error', message: t('auth.login.two-factor.verification-failed') });+ throw new Error(error.message);+ }+ },+ onSuccess: () => {+ navigate('/');+ },+ }));++ const handleTotpComplete = (code: string) => {+ setTotpCode(code);+ if (code.length === 6) {+ verifyMutation.mutate({ code, trust: trustDevice() });+ }+ };++ return (+ <div>+ <p class="text-muted-foreground mt-1 mb-4">+ {t('auth.login.two-factor.description.totp')}+ </p>++ <div class="flex flex-col gap-1 mb-4 items-center">+ <label class="sr-only">{t('auth.login.two-factor.code.label.totp')}</label>+ <TotpField value={totpCode()} onValueChange={handleTotpComplete} />+ <Show when={verifyMutation.error}>+ {getError => <div class="text-red-500 text-sm">{getError().message}</div>}+ </Show>++ <Checkbox class="flex items-center gap-2 mt-4" checked={trustDevice()} onChange={setTrustDevice}>+ <CheckboxControl />+ <CheckboxLabel class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">+ {t('auth.login.two-factor.trust-device.label')}+ </CheckboxLabel>+ </Checkbox>+ </div>+ </div>+ );+};++const BackupCodeVerificationForm: Component = () => {+ const navigate = useNavigate();+ const { t } = useI18n();+ const [trustDevice, setTrustDevice] = createSignal(false);++ const { form, Form, Field } = createForm({+ onSubmit: async ({ code }) => {+ const { error } = await twoFactor.verifyBackupCode({+ code,+ trustDevice: trustDevice(),+ });++ if (error) {+ createToast({ type: 'error', message: t('auth.login.two-factor.verification-failed') });+ throw new Error(error.message);+ }++ navigate('/');+ },+ schema: v.object({+ code: v.pipe(+ v.string(),+ v.nonEmpty(t('auth.login.two-factor.code.required')),+ ),+ }),+ initialValues: {+ code: '',+ },+ });++ return (+ <Form>+ <p class="text-muted-foreground mt-1 mb-4">+ {t('auth.login.two-factor.description.backup-code')}+ </p>++ <Field name="code">+ {(field, inputProps) => (+ <TextFieldRoot class="flex flex-col gap-1 mb-4">+ <TextFieldLabel for="backup-code">{t('auth.login.two-factor.code.label.backup-code')}</TextFieldLabel>+ <TextField+ type="text"+ id="backup-code"+ placeholder={t('auth.login.two-factor.code.placeholder.backup-code')}+ {...inputProps}+ autoFocus+ value={field.value}+ aria-invalid={Boolean(field.error)}+ />+ {field.error && <div class="text-red-500 text-sm">{field.error}</div>}+ </TextFieldRoot>+ )}+ </Field>++ <Checkbox class="flex items-center gap-2 mb-4" checked={trustDevice()} onChange={setTrustDevice}>+ <CheckboxControl />+ <CheckboxLabel class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">+ {t('auth.login.two-factor.trust-device.label')}+ </CheckboxLabel>+ </Checkbox>++ <Button type="submit" class="w-full" isLoading={form.submitting}>+ {t('auth.login.two-factor.submit')}+ </Button>++ <div class="text-red-500 text-sm mt-4">{form.response.message}</div>++ </Form>+ );+};++const TwoFactorVerificationForm: Component<{ onBack: () => void }> = (props) => {+ const [useBackupCode, setUseBackupCode] = createSignal(false);+ const { t } = useI18n();++ return (+ <div>+ <Show+ when={!useBackupCode()}+ fallback={(+ <BackupCodeVerificationForm />+ )}+ >+ <TotpVerificationForm />+ </Show>++ <div class="flex flex-col gap-2 mt-4">+ <Show+ when={!useBackupCode()}+ fallback={(+ <Button variant="link" class="p-0 h-auto text-muted-foreground" onClick={() => setUseBackupCode(false)}>+ {t('auth.login.two-factor.use-totp')}+ </Button>+ )}+ >+ <Button variant="link" class="p-0 h-auto text-muted-foreground" onClick={() => setUseBackupCode(true)}>+ {t('auth.login.two-factor.use-backup-code')}+ </Button>+ </Show>++ <Button variant="link" class="p-0 h-auto text-muted-foreground" onClick={props.onBack}>+ {t('auth.login.two-factor.back')}+ </Button>+ </div>++ </div>+ );+};++export const EmailLoginForm: Component<{ onTwoFactorRequired: () => void }> = (props) => {const navigate = useNavigate();const { config } = useConfig();const { t } = useI18n();@@ -28,7 +191,7 @@ export const EmailLoginForm: Component = () => {const { form, Form, Field } = createForm({onSubmit: async ({ email, password, rememberMe }) => {- const { error } = await signIn.email({+ const { data: loginResult, error } = await signIn.email({email,password,rememberMe,@@ -36,6 +199,11 @@ export const EmailLoginForm: Component = () => {callbackURL: buildUrl({ baseUrl: config.baseUrl, path: authPagesPaths.emailVerification }),});+ if (loginResult && 'twoFactorRedirect' in loginResult && loginResult.twoFactorRedirect) {+ props.onTwoFactorRequired();+ return;+ }+if (isEmailVerificationRequiredError({ error })) {navigate('/email-validation-required');}@@ -106,7 +274,7 @@ export const EmailLoginForm: Component = () => {</Show></div>- <Button type="submit" class="w-full">{t('auth.login.form.submit')}</Button>+ <Button type="submit" class="w-full" isLoading={form.submitting}>{t('auth.login.form.submit')}</Button><div class="text-red-500 text-sm mt-4">{form.response.message}</div>@@ -119,6 +287,7 @@ export const LoginPage: Component = () => {const { t } = useI18n();const [getShowEmailLoginForm, setShowEmailLoginForm] = createSignal(false);+ const [showTwoFactorForm, setShowTwoFactorForm] = createSignal(false);const loginWithProvider = async (provider: SsoProviderConfig) => {await authWithProvider({ provider, config });@@ -126,59 +295,69 @@ export const LoginPage: Component = () => {const getHasSsoProviders = () => getEnabledSsoProviderConfigs({ config }).length > 0;- if (!config.auth.providers.email.isEnabled && !getHasSsoProviders()) {- return <AuthLayout><NoAuthProviderWarning /></AuthLayout>;- }+ const hasNoAuthProviders = !config.auth.providers.email.isEnabled && !getHasSsoProviders();return (<AuthLayout>- <div class="flex items-center justify-center h-full p-6 sm:pb-32">- <div class="max-w-sm w-full">- <h1 class="text-xl font-bold">{t('auth.login.title')}</h1>- <p class="text-muted-foreground mt-1 mb-4">{t('auth.login.description')}</p>-- <Show when={config.auth.providers.email.isEnabled}>- {getShowEmailLoginForm() || !getHasSsoProviders()- ? <EmailLoginForm />- : (- <Button onClick={() => setShowEmailLoginForm(true)} class="w-full">- <div class="i-tabler-mail mr-2 size-4.5" />- {t('auth.login.login-with-provider', { provider: 'Email' })}- </Button>- )}- </Show>-- <Show when={config.auth.providers.email.isEnabled && getHasSsoProviders()}>- <Separator class="my-4" />- </Show>-- <Show when={getHasSsoProviders()}>-- <div class="flex flex-col gap-2">- <For each={getEnabledSsoProviderConfigs({ config })}>- {provider => (- <SsoProviderButton- name={provider.name}- icon={provider.icon}- onClick={() => loginWithProvider(provider)}- label={t('auth.login.login-with-provider', { provider: provider.name })}- />- )}- </For>- </div>- </Show>-- <p class="text-muted-foreground mt-4">- {t('auth.login.no-account')}- {' '}- <Button variant="link" as={A} class="inline px-0" href="/register">- {t('auth.login.register')}- </Button>- </p>+ <Show when={!hasNoAuthProviders} fallback={<NoAuthProviderWarning />}>+ <div class="flex items-center justify-center h-full p-6 sm:pb-32">+ <div class="max-w-sm w-full">+ <Show+ when={!showTwoFactorForm()}+ fallback={(+ <>+ <h1 class="text-xl font-bold">{t('auth.login.two-factor.title')}</h1>+ <TwoFactorVerificationForm onBack={() => setShowTwoFactorForm(false)} />+ </>+ )}+ >+ <h1 class="text-xl font-bold">{t('auth.login.title')}</h1>+ <p class="text-muted-foreground mt-1 mb-4">{t('auth.login.description')}</p>++ <Show when={config.auth.providers.email.isEnabled}>+ {getShowEmailLoginForm() || !getHasSsoProviders()+ ? <EmailLoginForm onTwoFactorRequired={() => setShowTwoFactorForm(true)} />+ : (+ <Button onClick={() => setShowEmailLoginForm(true)} class="w-full">+ <div class="i-tabler-mail mr-2 size-4.5" />+ {t('auth.login.login-with-provider', { provider: 'Email' })}+ </Button>+ )}+ </Show>++ <Show when={config.auth.providers.email.isEnabled && getHasSsoProviders()}>+ <Separator class="my-4" />+ </Show>- <AuthLegalLinks />+ <Show when={getHasSsoProviders()}>++ <div class="flex flex-col gap-2">+ <For each={getEnabledSsoProviderConfigs({ config })}>+ {provider => (+ <SsoProviderButton+ name={provider.name}+ icon={provider.icon}+ onClick={() => loginWithProvider(provider)}+ label={t('auth.login.login-with-provider', { provider: provider.name })}+ />+ )}+ </For>+ </div>+ </Show>++ <p class="text-muted-foreground mt-4">+ {t('auth.login.no-account')}+ {' '}+ <Button variant="link" as={A} class="inline px-0" href="/register">+ {t('auth.login.register')}+ </Button>+ </p>++ <AuthLegalLinks />+ </Show>+ </div></div>- </div>+ </Show></AuthLayout>);};diff --git a/apps/papra-client/src/modules/shared/files/download.ts b/apps/papra-client/src/modules/shared/files/download.tsindex 5e57a53a..907237cb 100644--- a/apps/papra-client/src/modules/shared/files/download.ts+++ b/apps/papra-client/src/modules/shared/files/download.ts@@ -4,3 +4,10 @@ export function downloadFile({ url, fileName = 'file' }: { url: string; fileNamelink.download = fileName;link.click();}++export function downloadTextFile({ content, fileName = 'file.txt' }: { content: string; fileName?: string }) {+ const blob = new Blob([content], { type: 'text/plain' });+ const url = URL.createObjectURL(blob);+ downloadFile({ url, fileName });+ URL.revokeObjectURL(url);+}diff --git a/apps/papra-client/src/modules/ui/components/otp-field.tsx b/apps/papra-client/src/modules/ui/components/otp-field.tsxnew file mode 100644index 00000000..343fc976--- /dev/null+++ b/apps/papra-client/src/modules/ui/components/otp-field.tsx@@ -0,0 +1,83 @@+import type { DynamicProps, RootProps } from '@corvu/otp-field';+import type { Component, ComponentProps, ValidComponent } from 'solid-js';++import OtpField from '@corvu/otp-field';+import { Show, splitProps } from 'solid-js';+import { cn } from '@/modules/shared/style/cn';++export const REGEXP_ONLY_DIGITS = '^\\d*$';+export const REGEXP_ONLY_CHARS = '^[a-zA-Z]*$';+export const REGEXP_ONLY_DIGITS_AND_CHARS = '^[a-zA-Z0-9]*$';++type OTPFieldProps<T extends ValidComponent = 'div'> = RootProps<T> & { class?: string };++function OTPField<T extends ValidComponent = 'div'>(props: DynamicProps<T, OTPFieldProps<T>>) {+ const [local, others] = splitProps(props as OTPFieldProps, ['class']);+ return (+ <OtpField+ class={cn(+ 'flex items-center gap-2 disabled:cursor-not-allowed has-[:disabled]:opacity-50',+ local.class,+ )}+ {...others}+ />+ );+}++const OTPFieldInput = OtpField.Input;++const OTPFieldGroup: Component<ComponentProps<'div'>> = (props) => {+ const [local, others] = splitProps(props, ['class']);+ return <div class={cn('flex items-center', local.class)} {...others} />;+};++const OTPFieldSlot: Component<ComponentProps<'div'> & { index: number }> = (props) => {+ const [local, others] = splitProps(props, ['class', 'index']);+ const context = OtpField.useContext();+ const char = () => context.value()[local.index];+ const showFakeCaret = () => context.value().length === local.index && context.isInserting();++ return (+ <div+ class={cn(+ 'group relative flex size-10 items-center justify-center border-y border-r border-input text-sm first:rounded-l-md first:border-l last:rounded-r-md',+ local.class,+ )}+ {...others}+ >+ <div+ class={cn(+ 'absolute inset-0 z-10 transition-all group-first:rounded-l-md group-last:rounded-r-md',+ context.activeSlots().includes(local.index) && 'ring-2 ring-ring ring-offset-background',+ )}+ />+ {char()}+ <Show when={showFakeCaret()}>+ <div class="pointer-events-none absolute inset-0 flex items-center justify-center">+ <div class="h-4 w-px animate-caret-blink bg-foreground duration-1000" />+ </div>+ </Show>+ </div>+ );+};++const OTPFieldSeparator: Component<ComponentProps<'div'>> = (props) => {+ return (+ <div {...props}>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+ class="size-6"+ >+ <circle cx="12.1" cy="12.1" r="1" />+ </svg>+ </div>+ );+};++export { OTPField, OTPFieldGroup, OTPFieldInput, OTPFieldSeparator, OTPFieldSlot };diff --git a/apps/papra-client/src/modules/ui/components/qr-code.tsx b/apps/papra-client/src/modules/ui/components/qr-code.tsxnew file mode 100644index 00000000..12408ad1--- /dev/null+++ b/apps/papra-client/src/modules/ui/components/qr-code.tsx@@ -0,0 +1,12 @@+import type { Component, ComponentProps } from 'solid-js';+import { splitProps } from 'solid-js';+import { renderSVG } from 'uqr';++export const QrCode: Component<{ value: string } & ComponentProps<'div'>> = (props) => {+ const [local, rest] = splitProps(props, ['value']);++ return (+ // eslint-disable-next-line solid/no-innerhtml+ <div innerHTML={renderSVG(local.value)} {...rest} />+ );+};diff --git a/apps/papra-client/src/modules/users/2fa.models.test.ts b/apps/papra-client/src/modules/users/2fa.models.test.tsnew file mode 100644index 00000000..901d3c92--- /dev/null+++ b/apps/papra-client/src/modules/users/2fa.models.test.ts@@ -0,0 +1,30 @@+import { describe, expect, test } from 'vitest';+import { getSecretFromTotpUri } from './2fa.models';++describe('2fa models', () => {+ describe('getSecretFromTotpUri', () => {+ test('in a valid TOTP URI the secret is a query parameter', () => {+ expect(+ getSecretFromTotpUri({+ totpUri: 'otpauth://totp/Papra:foo.bar%40gmail.com?secret=KFBVEMJQIVFW6RKMJNWTQ42OPBKG63DBK4YWSX2LG4REOQRXGZ3Q&issuer=Papra&digits=6&period=30',+ }),+ ).to.equal('KFBVEMJQIVFW6RKMJNWTQ42OPBKG63DBK4YWSX2LG4REOQRXGZ3Q');+ });++ test('if the TOTP URI does not have a secret query parameter, an empty string is returned', () => {+ expect(+ getSecretFromTotpUri({+ totpUri: 'otpauth://totp/Papra:foo.bar%40gmail.com?issuer=Papra&digits=6&period=30',+ }),+ ).to.equal('');+ });++ test('if the TOTP URI is malformed, an empty string is returned', () => {+ expect(+ getSecretFromTotpUri({+ totpUri: 'not-a-valid-uri',+ }),+ ).to.equal('');+ });+ });+});diff --git a/apps/papra-client/src/modules/users/2fa.models.ts b/apps/papra-client/src/modules/users/2fa.models.tsnew file mode 100644index 00000000..031685d6--- /dev/null+++ b/apps/papra-client/src/modules/users/2fa.models.ts@@ -0,0 +1,7 @@+export function getSecretFromTotpUri({ totpUri }: { totpUri: string }): string {+ try {+ return new URL(totpUri).searchParams.get('secret') ?? '';+ } catch {+ return '';+ }+}diff --git a/apps/papra-client/src/modules/users/components/two-factor-card.tsx b/apps/papra-client/src/modules/users/components/two-factor-card.tsxnew file mode 100644index 00000000..51a5f4d1--- /dev/null+++ b/apps/papra-client/src/modules/users/components/two-factor-card.tsx@@ -0,0 +1,470 @@+import type { Component } from 'solid-js';+import { useMutation } from '@tanstack/solid-query';+import { createSignal, For, Show } from 'solid-js';+import * as v from 'valibot';+import { twoFactor } from '@/modules/auth/auth.services';+import { TotpField } from '@/modules/auth/components/verify-otp.component';+import { useI18n } from '@/modules/i18n/i18n.provider';+import { downloadTextFile } from '@/modules/shared/files/download';+import { createForm } from '@/modules/shared/form/form';+import { useI18nApiErrors } from '@/modules/shared/http/composables/i18n-api-errors';+import { CopyButton } from '@/modules/shared/utils/copy';+import { Badge } from '@/modules/ui/components/badge';+import { Button } from '@/modules/ui/components/button';+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/modules/ui/components/card';+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from '@/modules/ui/components/dialog';+import { QrCode } from '@/modules/ui/components/qr-code';+import { createToast } from '@/modules/ui/components/sonner';+import { TextField, TextFieldErrorMessage, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';+import { getSecretFromTotpUri } from '../2fa.models';++const EnableTwoFactorDialog: Component<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ onSuccess: (data: { totpURI: string; backupCodes: string[] }) => void;+}> = (props) => {+ const { t } = useI18n();++ const passwordSchema = v.pipe(v.string(), v.minLength(1, t('user.settings.two-factor.enable-dialog.password.required')));++ const { form, Form, Field } = createForm({+ schema: v.object({+ password: passwordSchema,+ }),+ initialValues: {+ password: '',+ },+ onSubmit: async ({ password }) => {+ const { data, error } = await twoFactor.enable({ password });++ if (error) {+ createToast({ type: 'error', message: error.message });+ return;+ }++ const { totpURI, backupCodes } = data;++ props.onSuccess({ totpURI, backupCodes });+ },+ });++ return (+ <Dialog open={props.open} onOpenChange={props.onOpenChange}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('user.settings.two-factor.enable-dialog.title')}</DialogTitle>+ <DialogDescription>{t('user.settings.two-factor.enable-dialog.description')}</DialogDescription>+ </DialogHeader>+ <Form>+ <Field name="password">+ {(field, inputProps) => (+ <TextFieldRoot>+ <TextFieldLabel for="enable-password">+ {t('user.settings.two-factor.enable-dialog.password.label')}+ </TextFieldLabel>+ <TextField+ type="password"+ id="enable-password"+ placeholder={t('user.settings.two-factor.enable-dialog.password.placeholder')}+ {...inputProps}+ value={field.value}+ aria-invalid={Boolean(field.error)}+ />+ {field.error && <TextFieldErrorMessage>{field.error}</TextFieldErrorMessage>}+ </TextFieldRoot>+ )}+ </Field>+ <DialogFooter class="mt-6">+ <Button variant="outline" onClick={() => props.onOpenChange(false)}>+ {t('user.settings.two-factor.enable-dialog.cancel')}+ </Button>+ <Button type="submit" isLoading={form.submitting}>+ {t('user.settings.two-factor.enable-dialog.submit')}+ </Button>+ </DialogFooter>+ </Form>+ </DialogContent>+ </Dialog>+ );+};++const SetupTwoFactorDialog: Component<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ totpUri: string;+ onSuccess: () => void;+}> = (props) => {+ const { t } = useI18n();+ const getTotpSecret = () => getSecretFromTotpUri({ totpUri: props.totpUri });+ const [getTotpCode, setTotpCode] = createSignal<string>('');+ const { createI18nApiError } = useI18nApiErrors();++ const verifyMutation = useMutation(() => ({+ mutationFn: async ({ totpCode }: { totpCode: string }) => {+ const { error } = await twoFactor.verifyTotp({ code: totpCode });+ if (error) {+ throw createI18nApiError({ error });+ }+ },+ onSuccess: () => {+ props.onSuccess();+ createToast({ type: 'success', message: t('user.settings.two-factor.enabled') });+ },+ }));++ return (+ <Dialog+ open={props.open}+ onOpenChange={props.onOpenChange}+ >+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('user.settings.two-factor.setup-dialog.title')}</DialogTitle>+ </DialogHeader>+ <div>++ <h3 class="font-semibold">{t('user.settings.two-factor.setup-dialog.step1.title')}</h3>+ <p class="mb-4 text-sm text-muted-foreground">+ {t('user.settings.two-factor.setup-dialog.step1.description')}+ </p>++ <div class="flex flex-col items-center">+ <QrCode value={props.totpUri} class="w-full max-w-48" />++ <CopyButton text={getTotpSecret()} variant="outline" label={t('user.settings.two-factor.setup-dialog.copy-setup-key')} size="sm" class="mt-2" />+ </div>++ <h3 class="mt-8 font-semibold">{t('user.settings.two-factor.setup-dialog.step2.title')}</h3>+ <p class="mb-4 text-sm text-muted-foreground">+ {t('user.settings.two-factor.setup-dialog.step2.description')}+ </p>++ <div class="mt-4 flex justify-center">+ <TotpField value={getTotpCode()} onValueChange={setTotpCode} />+ </div>++ <Show when={verifyMutation.error}>{getError => (<div class="text-red">{getError().message}</div>)}</Show>++ <div class="flex md:flex-row flex-col justify-end gap-2 mt-6">+ <Button variant="outline" onClick={() => props.onOpenChange(false)}>+ {t('user.settings.two-factor.setup-dialog.cancel')}+ </Button>+ <Button type="submit" isLoading={verifyMutation.isPending} onClick={() => verifyMutation.mutate({ totpCode: getTotpCode() })}>+ {t('user.settings.two-factor.setup-dialog.verify')}+ </Button>+ </div>+ </div>+ </DialogContent>+ </Dialog>+ );+};++const BackupCodesDialog: Component<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ backupCodes: string[];+}> = (props) => {+ const { t } = useI18n();++ return (+ <Dialog open={props.open} onOpenChange={props.onOpenChange}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('user.settings.two-factor.backup-codes-dialog.title')}</DialogTitle>+ <DialogDescription>{t('user.settings.two-factor.backup-codes-dialog.description')}</DialogDescription>+ </DialogHeader>+ <div>+ <div class="p-4 rounded-md bg-background border">+ <div class="grid grid-cols-2 gap-2 font-mono text-sm">+ <For each={props.backupCodes}>+ {code => (+ <div class="text-center">{code}</div>+ )}+ </For>+ </div>+ </div>++ <div class="flex justify-center mt-2 md:flex-row flex-col gap-2">+ <CopyButton+ text={props.backupCodes.join('\n')}+ label={t('user.settings.two-factor.backup-codes-dialog.copy')}+ variant="outline"+ size="sm"+ />++ <Button+ variant="outline"+ size="sm"+ onClick={() => downloadTextFile({+ content: props.backupCodes.join('\n'),+ fileName: t('user.settings.two-factor.backup-codes-dialog.download-filename'),+ })}+ >+ <div class="i-tabler-download size-4 mr-2" />+ {t('user.settings.two-factor.backup-codes-dialog.download')}+ </Button>+ </div>+ </div>+ <DialogFooter class="mt-4">+ <Button onClick={() => props.onOpenChange(false)}>+ {t('user.settings.two-factor.backup-codes-dialog.close')}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};++const DisableTwoFactorDialog: Component<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ onSuccess: () => void;+}> = (props) => {+ const { t } = useI18n();++ const passwordSchema = v.pipe(v.string(), v.minLength(1, t('user.settings.two-factor.disable-dialog.password.required')));++ const { form, Form, Field } = createForm({+ schema: v.object({+ password: passwordSchema,+ }),+ initialValues: {+ password: '',+ },+ onSubmit: async ({ password }) => {+ const { error } = await twoFactor.disable({ password });++ if (error) {+ createToast({ type: 'error', message: error.message });+ return;+ }++ props.onSuccess();+ createToast({ type: 'success', message: t('user.settings.two-factor.disabled') });+ },+ });++ return (+ <Dialog open={props.open} onOpenChange={props.onOpenChange}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('user.settings.two-factor.disable-dialog.title')}</DialogTitle>+ <DialogDescription>{t('user.settings.two-factor.disable-dialog.description')}</DialogDescription>+ </DialogHeader>+ <Form>+ <Field name="password">+ {(field, inputProps) => (+ <TextFieldRoot>+ <TextFieldLabel for="disable-password">+ {t('user.settings.two-factor.disable-dialog.password.label')}+ </TextFieldLabel>+ <TextField+ type="password"+ id="disable-password"+ placeholder={t('user.settings.two-factor.disable-dialog.password.placeholder')}+ {...inputProps}+ value={field.value}+ aria-invalid={Boolean(field.error)}+ />+ {field.error && <TextFieldErrorMessage>{field.error}</TextFieldErrorMessage>}+ </TextFieldRoot>+ )}+ </Field>+ <DialogFooter class="mt-6">+ <Button variant="outline" onClick={() => props.onOpenChange(false)}>+ {t('user.settings.two-factor.disable-dialog.cancel')}+ </Button>+ <Button type="submit" variant="destructive" isLoading={form.submitting}>+ {t('user.settings.two-factor.disable-dialog.submit')}+ </Button>+ </DialogFooter>+ </Form>+ </DialogContent>+ </Dialog>+ );+};++const RegenerateBackupCodesDialog: Component<{+ open: boolean;+ onOpenChange: (open: boolean) => void;+ onSuccess: (backupCodes: string[]) => void;+}> = (props) => {+ const { t } = useI18n();++ const passwordSchema = v.pipe(v.string(), v.minLength(1, t('user.settings.two-factor.regenerate-dialog.password.required')));++ const { form, Form, Field } = createForm({+ schema: v.object({+ password: passwordSchema,+ }),+ initialValues: {+ password: '',+ },+ onSubmit: async ({ password }) => {+ const { data, error } = await twoFactor.generateBackupCodes({ password });++ if (error) {+ createToast({ type: 'error', message: error.message });+ return;+ }++ if (data?.backupCodes) {+ props.onSuccess(data.backupCodes);+ createToast({ type: 'success', message: t('user.settings.two-factor.codes-regenerated') });+ }+ },+ });++ return (+ <Dialog open={props.open} onOpenChange={props.onOpenChange}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>{t('user.settings.two-factor.regenerate-dialog.title')}</DialogTitle>+ <DialogDescription>{t('user.settings.two-factor.regenerate-dialog.description')}</DialogDescription>+ </DialogHeader>+ <Form>+ <Field name="password">+ {(field, inputProps) => (+ <TextFieldRoot>+ <TextFieldLabel for="regenerate-password">+ {t('user.settings.two-factor.regenerate-dialog.password.label')}+ </TextFieldLabel>+ <TextField+ type="password"+ id="regenerate-password"+ placeholder={t('user.settings.two-factor.regenerate-dialog.password.placeholder')}+ {...inputProps}+ value={field.value}+ aria-invalid={Boolean(field.error)}+ />+ {field.error && <TextFieldErrorMessage>{field.error}</TextFieldErrorMessage>}+ </TextFieldRoot>+ )}+ </Field>+ <DialogFooter class="mt-6">+ <Button variant="outline" onClick={() => props.onOpenChange(false)}>+ {t('user.settings.two-factor.regenerate-dialog.cancel')}+ </Button>+ <Button type="submit" isLoading={form.submitting}>+ {t('user.settings.two-factor.regenerate-dialog.submit')}+ </Button>+ </DialogFooter>+ </Form>+ </DialogContent>+ </Dialog>+ );+};++type DialogState = 'none' | 'enable-password' | 'setup-qr' | 'backup-codes' | 'disable-password' | 'regenerate-codes';++export const TwoFactorCard: Component<{ twoFactorEnabled: boolean; onUpdate: () => void }> = (props) => {+ const { t } = useI18n();+ const [dialogState, setDialogState] = createSignal<DialogState>('none');+ const [totpUri, setTotpUri] = createSignal<string>('');+ const [backupCodes, setBackupCodes] = createSignal<string[]>([]);++ const handleEnableSuccess = (data: { totpURI: string; backupCodes: string[] }) => {+ setTotpUri(data.totpURI);+ setBackupCodes(data.backupCodes);+ setDialogState('setup-qr');+ };++ const handleSetupSuccess = () => {+ setDialogState('backup-codes');+ props.onUpdate();+ createToast({ type: 'success', message: t('user.settings.two-factor.enabled') });+ };++ const handleDisableSuccess = () => {+ setDialogState('none');+ props.onUpdate();+ };++ const handleRegenerateSuccess = (codes: string[]) => {+ setBackupCodes(codes);+ setDialogState('backup-codes');+ };++ const closeDialog = () => {+ setDialogState('none');+ setTotpUri('');+ setBackupCodes([]);+ };++ return (+ <>+ <Card>+ <CardHeader class="border-b">+ <div class="flex items-center justify-between">+ <div>+ <CardTitle>{t('user.settings.two-factor.title')}</CardTitle>+ <CardDescription>{t('user.settings.two-factor.description')}</CardDescription>+ </div>+ <Badge variant={props.twoFactorEnabled ? 'default' : 'secondary'}>+ {props.twoFactorEnabled+ ? t('user.settings.two-factor.status.enabled')+ : t('user.settings.two-factor.status.disabled')}+ </Badge>+ </div>+ </CardHeader>+ <CardContent class="pt-6">+ <div class="flex flex-row justify-end gap-3">+ <Show+ when={props.twoFactorEnabled}+ fallback={(+ <Button onClick={() => setDialogState('enable-password')}>+ {t('user.settings.two-factor.enable-button')}+ </Button>+ )}+ >+ <Button variant="outline" onClick={() => setDialogState('regenerate-codes')}>+ {t('user.settings.two-factor.regenerate-codes-button')}+ </Button>+ <Button variant="destructive" onClick={() => setDialogState('disable-password')}>+ {t('user.settings.two-factor.disable-button')}+ </Button>+ </Show>+ </div>+ </CardContent>+ </Card>++ <EnableTwoFactorDialog+ open={dialogState() === 'enable-password'}+ onOpenChange={open => !open && closeDialog()}+ onSuccess={handleEnableSuccess}+ />++ <SetupTwoFactorDialog+ open={dialogState() === 'setup-qr'}+ onOpenChange={open => !open && closeDialog()}+ totpUri={totpUri()}+ onSuccess={handleSetupSuccess}+ />++ <BackupCodesDialog+ open={dialogState() === 'backup-codes'}+ onOpenChange={open => !open && closeDialog()}+ backupCodes={backupCodes()}+ />++ <DisableTwoFactorDialog+ open={dialogState() === 'disable-password'}+ onOpenChange={open => !open && closeDialog()}+ onSuccess={handleDisableSuccess}+ />++ <RegenerateBackupCodesDialog+ open={dialogState() === 'regenerate-codes'}+ onOpenChange={open => !open && closeDialog()}+ onSuccess={handleRegenerateSuccess}+ />+ </>+ );+};diff --git a/apps/papra-client/src/modules/users/pages/user-settings.page.tsx b/apps/papra-client/src/modules/users/pages/user-settings.page.tsxindex ee2264aa..91a73592 100644--- a/apps/papra-client/src/modules/users/pages/user-settings.page.tsx+++ b/apps/papra-client/src/modules/users/pages/user-settings.page.tsx@@ -10,6 +10,7 @@ import { Button } from '@/modules/ui/components/button';import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/modules/ui/components/card';import { createToast } from '@/modules/ui/components/sonner';import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield';+import { TwoFactorCard } from '../components/two-factor-card';import { useUpdateCurrentUser } from '../users.composables';import { nameSchema } from '../users.schemas';import { fetchCurrentUser } from '../users.services';@@ -147,6 +148,7 @@ export const UserSettingsPage: Component = () => {<div class="mt-6 flex flex-col gap-6"><UserEmailCard email={getUser().email} /><UpdateFullNameCard name={getUser().name} />+ <TwoFactorCard twoFactorEnabled={getUser().twoFactorEnabled} onUpdate={() => query.refetch()} /><LogoutCard /></div></>diff --git a/apps/papra-client/src/modules/users/users.types.ts b/apps/papra-client/src/modules/users/users.types.tsindex b2fba5a3..dc381002 100644--- a/apps/papra-client/src/modules/users/users.types.ts+++ b/apps/papra-client/src/modules/users/users.types.ts@@ -6,6 +6,7 @@ export type User = {updatedAt: Date;emailVerified: boolean;maxOrganizationCount: number | null;+ twoFactorEnabled: boolean;};export type UserMe = User & {diff --git a/apps/papra-server/src/migrations/list/0014-two-factor-authentication.migration.ts b/apps/papra-server/src/migrations/list/0014-two-factor-authentication.migration.tsnew file mode 100644index 00000000..97b3d018--- /dev/null+++ b/apps/papra-server/src/migrations/list/0014-two-factor-authentication.migration.ts@@ -0,0 +1,38 @@+import type { BatchItem } from 'drizzle-orm/batch';+import type { Migration } from '../migrations.types';+import { sql } from 'drizzle-orm';++export const twoFactorAuthenticationMigration = {+ name: 'two-factor-authentication',++ up: async ({ db }) => {+ const tableInfo = await db.run(sql`PRAGMA table_info(users)`);+ const existingColumns = tableInfo.rows.map(row => row.name);+ const hasColumn = (columnName: string) => existingColumns.includes(columnName);++ const statements = [+ sql`+ CREATE TABLE IF NOT EXISTS "auth_two_factor" (+ "id" text PRIMARY KEY NOT NULL,+ "created_at" integer NOT NULL,+ "updated_at" integer NOT NULL,+ "user_id" text,+ "secret" text,+ "backup_codes" text,+ FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade+ );+ `,++ ...(!hasColumn('two_factor_enabled') ? [sql`ALTER TABLE "users" ADD "two_factor_enabled" integer DEFAULT false NOT NULL;`] : []),+ ];++ await db.batch(statements.map(statement => db.run(statement) as BatchItem<'sqlite'>) as [BatchItem<'sqlite'>, ...BatchItem<'sqlite'>[]]);+ },++ down: async ({ db }) => {+ await db.batch([+ db.run(sql`DROP TABLE IF EXISTS "auth_two_factor";`),+ db.run(sql`ALTER TABLE "users" DROP COLUMN "two_factor_enabled";`),+ ]);+ },+} satisfies Migration;diff --git a/apps/papra-server/src/migrations/meta/0012_snapshot.json b/apps/papra-server/src/migrations/meta/0012_snapshot.jsonnew file mode 100644index 00000000..a234a617--- /dev/null+++ b/apps/papra-server/src/migrations/meta/0012_snapshot.json@@ -0,0 +1,2170 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "1d039177-2d51-403b-a8b4-8cc37f65aef1",+ "prevId": "7407bb9b-b179-4a4c-89c6-ac869979f836",+ "tables": {+ "document_activity_log": {+ "name": "document_activity_log",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "event": {+ "name": "event",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "event_data": {+ "name": "event_data",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "tag_id": {+ "name": "tag_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "document_activity_log_document_id_documents_id_fk": {+ "name": "document_activity_log_document_id_documents_id_fk",+ "tableFrom": "document_activity_log",+ "tableTo": "documents",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "document_activity_log_user_id_users_id_fk": {+ "name": "document_activity_log_user_id_users_id_fk",+ "tableFrom": "document_activity_log",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ },+ "document_activity_log_tag_id_tags_id_fk": {+ "name": "document_activity_log_tag_id_tags_id_fk",+ "tableFrom": "document_activity_log",+ "tableTo": "tags",+ "columnsFrom": [+ "tag_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "documents": {+ "name": "documents",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "original_name": {+ "name": "original_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "original_size": {+ "name": "original_size",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 0+ },+ "original_storage_key": {+ "name": "original_storage_key",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "original_sha256_hash": {+ "name": "original_sha256_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "mime_type": {+ "name": "mime_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "file_encryption_key_wrapped": {+ "name": "file_encryption_key_wrapped",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "file_encryption_kek_version": {+ "name": "file_encryption_kek_version",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "file_encryption_algorithm": {+ "name": "file_encryption_algorithm",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "deleted_by": {+ "name": "deleted_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "is_deleted": {+ "name": "is_deleted",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "documents_organization_id_is_deleted_created_at_index": {+ "name": "documents_organization_id_is_deleted_created_at_index",+ "columns": [+ "organization_id",+ "is_deleted",+ "created_at"+ ],+ "isUnique": false+ },+ "documents_organization_id_is_deleted_index": {+ "name": "documents_organization_id_is_deleted_index",+ "columns": [+ "organization_id",+ "is_deleted"+ ],+ "isUnique": false+ },+ "documents_organization_id_original_sha256_hash_unique": {+ "name": "documents_organization_id_original_sha256_hash_unique",+ "columns": [+ "organization_id",+ "original_sha256_hash"+ ],+ "isUnique": true+ },+ "documents_original_sha256_hash_index": {+ "name": "documents_original_sha256_hash_index",+ "columns": [+ "original_sha256_hash"+ ],+ "isUnique": false+ },+ "documents_organization_id_size_index": {+ "name": "documents_organization_id_size_index",+ "columns": [+ "organization_id",+ "original_size"+ ],+ "isUnique": false+ },+ "documents_file_encryption_kek_version_index": {+ "name": "documents_file_encryption_kek_version_index",+ "columns": [+ "file_encryption_kek_version"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "documents_organization_id_organizations_id_fk": {+ "name": "documents_organization_id_organizations_id_fk",+ "tableFrom": "documents",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "documents_created_by_users_id_fk": {+ "name": "documents_created_by_users_id_fk",+ "tableFrom": "documents",+ "tableTo": "users",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ },+ "documents_deleted_by_users_id_fk": {+ "name": "documents_deleted_by_users_id_fk",+ "tableFrom": "documents",+ "tableTo": "users",+ "columnsFrom": [+ "deleted_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "organization_invitations": {+ "name": "organization_invitations",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "inviter_id": {+ "name": "inviter_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_invitations_organization_email_unique": {+ "name": "organization_invitations_organization_email_unique",+ "columns": [+ "organization_id",+ "email"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "organization_invitations_organization_id_organizations_id_fk": {+ "name": "organization_invitations_organization_id_organizations_id_fk",+ "tableFrom": "organization_invitations",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "organization_invitations_inviter_id_users_id_fk": {+ "name": "organization_invitations_inviter_id_users_id_fk",+ "tableFrom": "organization_invitations",+ "tableTo": "users",+ "columnsFrom": [+ "inviter_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "organization_members": {+ "name": "organization_members",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "organization_members_user_organization_unique": {+ "name": "organization_members_user_organization_unique",+ "columns": [+ "organization_id",+ "user_id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "organization_members_organization_id_organizations_id_fk": {+ "name": "organization_members_organization_id_organizations_id_fk",+ "tableFrom": "organization_members",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "organization_members_user_id_users_id_fk": {+ "name": "organization_members_user_id_users_id_fk",+ "tableFrom": "organization_members",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "organizations": {+ "name": "organizations",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "customer_id": {+ "name": "customer_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "deleted_by": {+ "name": "deleted_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scheduled_purge_at": {+ "name": "scheduled_purge_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "organizations_deleted_at_purge_at_index": {+ "name": "organizations_deleted_at_purge_at_index",+ "columns": [+ "deleted_at",+ "scheduled_purge_at"+ ],+ "isUnique": false+ },+ "organizations_deleted_by_deleted_at_index": {+ "name": "organizations_deleted_by_deleted_at_index",+ "columns": [+ "deleted_by",+ "deleted_at"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "organizations_deleted_by_users_id_fk": {+ "name": "organizations_deleted_by_users_id_fk",+ "tableFrom": "organizations",+ "tableTo": "users",+ "columnsFrom": [+ "deleted_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user_roles": {+ "name": "user_roles",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "user_roles_role_index": {+ "name": "user_roles_role_index",+ "columns": [+ "role"+ ],+ "isUnique": false+ },+ "user_roles_user_id_role_unique_index": {+ "name": "user_roles_user_id_role_unique_index",+ "columns": [+ "user_id",+ "role"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "user_roles_user_id_users_id_fk": {+ "name": "user_roles_user_id_users_id_fk",+ "tableFrom": "user_roles",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "documents_tags": {+ "name": "documents_tags",+ "columns": {+ "document_id": {+ "name": "document_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tag_id": {+ "name": "tag_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "documents_tags_document_id_documents_id_fk": {+ "name": "documents_tags_document_id_documents_id_fk",+ "tableFrom": "documents_tags",+ "tableTo": "documents",+ "columnsFrom": [+ "document_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "documents_tags_tag_id_tags_id_fk": {+ "name": "documents_tags_tag_id_tags_id_fk",+ "tableFrom": "documents_tags",+ "tableTo": "tags",+ "columnsFrom": [+ "tag_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {+ "documents_tags_pkey": {+ "columns": [+ "document_id",+ "tag_id"+ ],+ "name": "documents_tags_pkey"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "tags": {+ "name": "tags",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "tags_organization_id_name_unique": {+ "name": "tags_organization_id_name_unique",+ "columns": [+ "organization_id",+ "name"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "tags_organization_id_organizations_id_fk": {+ "name": "tags_organization_id_organizations_id_fk",+ "tableFrom": "tags",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "users": {+ "name": "users",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email_verified": {+ "name": "email_verified",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "max_organization_count": {+ "name": "max_organization_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "two_factor_enabled": {+ "name": "two_factor_enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "users_email_unique": {+ "name": "users_email_unique",+ "columns": [+ "email"+ ],+ "isUnique": true+ },+ "users_email_index": {+ "name": "users_email_index",+ "columns": [+ "email"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "api_key_organizations": {+ "name": "api_key_organizations",+ "columns": {+ "api_key_id": {+ "name": "api_key_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_member_id": {+ "name": "organization_member_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "api_key_organizations_api_key_id_api_keys_id_fk": {+ "name": "api_key_organizations_api_key_id_api_keys_id_fk",+ "tableFrom": "api_key_organizations",+ "tableTo": "api_keys",+ "columnsFrom": [+ "api_key_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "api_key_organizations_organization_member_id_organization_members_id_fk": {+ "name": "api_key_organizations_organization_member_id_organization_members_id_fk",+ "tableFrom": "api_key_organizations",+ "tableTo": "organization_members",+ "columnsFrom": [+ "organization_member_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "api_keys": {+ "name": "api_keys",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "key_hash": {+ "name": "key_hash",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "prefix": {+ "name": "prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "last_used_at": {+ "name": "last_used_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "permissions": {+ "name": "permissions",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'[]'"+ },+ "all_organizations": {+ "name": "all_organizations",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {+ "api_keys_key_hash_unique": {+ "name": "api_keys_key_hash_unique",+ "columns": [+ "key_hash"+ ],+ "isUnique": true+ },+ "key_hash_index": {+ "name": "key_hash_index",+ "columns": [+ "key_hash"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "api_keys_user_id_users_id_fk": {+ "name": "api_keys_user_id_users_id_fk",+ "tableFrom": "api_keys",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "auth_accounts": {+ "name": "auth_accounts",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "account_id": {+ "name": "account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider_id": {+ "name": "provider_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "access_token_expires_at": {+ "name": "access_token_expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "refresh_token_expires_at": {+ "name": "refresh_token_expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "auth_accounts_user_id_users_id_fk": {+ "name": "auth_accounts_user_id_users_id_fk",+ "tableFrom": "auth_accounts",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "auth_sessions": {+ "name": "auth_sessions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "ip_address": {+ "name": "ip_address",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "user_agent": {+ "name": "user_agent",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "active_organization_id": {+ "name": "active_organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "auth_sessions_token_index": {+ "name": "auth_sessions_token_index",+ "columns": [+ "token"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "auth_sessions_user_id_users_id_fk": {+ "name": "auth_sessions_user_id_users_id_fk",+ "tableFrom": "auth_sessions",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "auth_sessions_active_organization_id_organizations_id_fk": {+ "name": "auth_sessions_active_organization_id_organizations_id_fk",+ "tableFrom": "auth_sessions",+ "tableTo": "organizations",+ "columnsFrom": [+ "active_organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "auth_two_factor": {+ "name": "auth_two_factor",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "backup_codes": {+ "name": "backup_codes",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "auth_two_factor_user_id_users_id_fk": {+ "name": "auth_two_factor_user_id_users_id_fk",+ "tableFrom": "auth_two_factor",+ "tableTo": "users",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "auth_verifications": {+ "name": "auth_verifications",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "auth_verifications_identifier_index": {+ "name": "auth_verifications_identifier_index",+ "columns": [+ "identifier"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "documents_fts": {+ "name": "documents_fts",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "original_name": {+ "name": "original_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "intake_emails": {+ "name": "intake_emails",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email_address": {+ "name": "email_address",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "allowed_origins": {+ "name": "allowed_origins",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'[]'"+ },+ "is_enabled": {+ "name": "is_enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ }+ },+ "indexes": {+ "intake_emails_email_address_unique": {+ "name": "intake_emails_email_address_unique",+ "columns": [+ "email_address"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "intake_emails_organization_id_organizations_id_fk": {+ "name": "intake_emails_organization_id_organizations_id_fk",+ "tableFrom": "intake_emails",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "organization_subscriptions": {+ "name": "organization_subscriptions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "customer_id": {+ "name": "customer_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "plan_id": {+ "name": "plan_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "seats_count": {+ "name": "seats_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "current_period_end": {+ "name": "current_period_end",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "current_period_start": {+ "name": "current_period_start",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "cancel_at_period_end": {+ "name": "cancel_at_period_end",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "organization_subscriptions_organization_id_organizations_id_fk": {+ "name": "organization_subscriptions_organization_id_organizations_id_fk",+ "tableFrom": "organization_subscriptions",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "tagging_rule_actions": {+ "name": "tagging_rule_actions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tagging_rule_id": {+ "name": "tagging_rule_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tag_id": {+ "name": "tag_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "tagging_rule_actions_tagging_rule_id_tagging_rules_id_fk": {+ "name": "tagging_rule_actions_tagging_rule_id_tagging_rules_id_fk",+ "tableFrom": "tagging_rule_actions",+ "tableTo": "tagging_rules",+ "columnsFrom": [+ "tagging_rule_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ },+ "tagging_rule_actions_tag_id_tags_id_fk": {+ "name": "tagging_rule_actions_tag_id_tags_id_fk",+ "tableFrom": "tagging_rule_actions",+ "tableTo": "tags",+ "columnsFrom": [+ "tag_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "tagging_rule_conditions": {+ "name": "tagging_rule_conditions",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "tagging_rule_id": {+ "name": "tagging_rule_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "field": {+ "name": "field",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "operator": {+ "name": "operator",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "is_case_sensitive": {+ "name": "is_case_sensitive",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "tagging_rule_conditions_tagging_rule_id_tagging_rules_id_fk": {+ "name": "tagging_rule_conditions_tagging_rule_id_tagging_rules_id_fk",+ "tableFrom": "tagging_rule_conditions",+ "tableTo": "tagging_rules",+ "columnsFrom": [+ "tagging_rule_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "tagging_rules": {+ "name": "tagging_rules",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "enabled": {+ "name": "enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "condition_match_mode": {+ "name": "condition_match_mode",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'all'"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "tagging_rules_organization_id_organizations_id_fk": {+ "name": "tagging_rules_organization_id_organizations_id_fk",+ "tableFrom": "tagging_rules",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "webhook_deliveries": {+ "name": "webhook_deliveries",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "webhook_id": {+ "name": "webhook_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "event_name": {+ "name": "event_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "request_payload": {+ "name": "request_payload",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "response_payload": {+ "name": "response_payload",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "response_status": {+ "name": "response_status",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "webhook_deliveries_webhook_id_webhooks_id_fk": {+ "name": "webhook_deliveries_webhook_id_webhooks_id_fk",+ "tableFrom": "webhook_deliveries",+ "tableTo": "webhooks",+ "columnsFrom": [+ "webhook_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "webhook_events": {+ "name": "webhook_events",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "webhook_id": {+ "name": "webhook_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "event_name": {+ "name": "event_name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "webhook_events_webhook_id_event_name_unique": {+ "name": "webhook_events_webhook_id_event_name_unique",+ "columns": [+ "webhook_id",+ "event_name"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "webhook_events_webhook_id_webhooks_id_fk": {+ "name": "webhook_events_webhook_id_webhooks_id_fk",+ "tableFrom": "webhook_events",+ "tableTo": "webhooks",+ "columnsFrom": [+ "webhook_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "webhooks": {+ "name": "webhooks",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "url": {+ "name": "url",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "secret": {+ "name": "secret",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "enabled": {+ "name": "enabled",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "webhooks_created_by_users_id_fk": {+ "name": "webhooks_created_by_users_id_fk",+ "tableFrom": "webhooks",+ "tableTo": "users",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "cascade"+ },+ "webhooks_organization_id_organizations_id_fk": {+ "name": "webhooks_organization_id_organizations_id_fk",+ "tableFrom": "webhooks",+ "tableTo": "organizations",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}diff --git a/apps/papra-server/src/migrations/meta/_journal.json b/apps/papra-server/src/migrations/meta/_journal.jsonindex 8c1a1632..855cf73d 100644--- a/apps/papra-server/src/migrations/meta/_journal.json+++ b/apps/papra-server/src/migrations/meta/_journal.json@@ -85,6 +85,13 @@"when": 1761645190314,"tag": "0011_tagging-rule-condition-match-mode","breakpoints": true+ },+ {+ "idx": 12,+ "version": "6",+ "when": 1766411483931,+ "tag": "0012_two-factor-authentication",+ "breakpoints": true}]}diff --git a/apps/papra-server/src/migrations/migrations.registry.test.ts b/apps/papra-server/src/migrations/migrations.registry.test.tsindex ff137ceb..40b0b741 100644--- a/apps/papra-server/src/migrations/migrations.registry.test.ts+++ b/apps/papra-server/src/migrations/migrations.registry.test.ts@@ -96,6 +96,7 @@ describe('migrations registry', () => {CREATE TABLE "api_keys" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "name" text NOT NULL, "key_hash" text NOT NULL, "prefix" text NOT NULL, "user_id" text NOT NULL, "last_used_at" integer, "expires_at" integer, "permissions" text DEFAULT '[]' NOT NULL, "all_organizations" integer DEFAULT false NOT NULL, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "auth_accounts" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "user_id" text, "account_id" text NOT NULL, "provider_id" text NOT NULL, "access_token" text, "refresh_token" text, "access_token_expires_at" integer, "refresh_token_expires_at" integer, "scope" text, "id_token" text, "password" text, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "auth_sessions" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "token" text NOT NULL, "user_id" text, "expires_at" integer NOT NULL, "ip_address" text, "user_agent" text, "active_organization_id" text, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("active_organization_id") REFERENCES "organizations"("id") ON UPDATE cascade ON DELETE set null );+ CREATE TABLE "auth_two_factor" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "user_id" text, "secret" text, "backup_codes" text, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "auth_verifications" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "identifier" text NOT NULL, "value" text NOT NULL, "expires_at" integer NOT NULL );CREATE TABLE "document_activity_log" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "document_id" text NOT NULL, "event" text NOT NULL, "event_data" text, "user_id" text, "tag_id" text, FOREIGN KEY ("document_id") REFERENCES "documents"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE set null, FOREIGN KEY ("tag_id") REFERENCES "tags"("id") ON UPDATE cascade ON DELETE set null );CREATE TABLE "documents" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "is_deleted" integer DEFAULT false NOT NULL, "deleted_at" integer, "organization_id" text NOT NULL, "created_by" text, "deleted_by" text, "original_name" text NOT NULL, "original_size" integer DEFAULT 0 NOT NULL, "original_storage_key" text NOT NULL, "original_sha256_hash" text NOT NULL, "name" text NOT NULL, "mime_type" text NOT NULL, "content" text DEFAULT '' NOT NULL, file_encryption_key_wrapped TEXT, file_encryption_kek_version TEXT, file_encryption_algorithm TEXT, FOREIGN KEY ("organization_id") REFERENCES "organizations"("id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("created_by") REFERENCES "users"("id") ON UPDATE cascade ON DELETE set null, FOREIGN KEY ("deleted_by") REFERENCES "users"("id") ON UPDATE cascade ON DELETE set null );@@ -118,7 +119,7 @@ describe('migrations registry', () => {CREATE TABLE "tagging_rules" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "organization_id" text NOT NULL, "name" text NOT NULL, "description" text, "enabled" integer DEFAULT true NOT NULL, "condition_match_mode" text DEFAULT 'all' NOT NULL, FOREIGN KEY ("organization_id") REFERENCES "organizations"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "tags" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "organization_id" text NOT NULL, "name" text NOT NULL, "color" text NOT NULL, "description" text, FOREIGN KEY ("organization_id") REFERENCES "organizations"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "user_roles" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "user_id" text NOT NULL, "role" text NOT NULL, FOREIGN KEY ("user_id") REFERENCES "users"("id") ON UPDATE cascade ON DELETE cascade );- CREATE TABLE "users" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "email" text NOT NULL, "email_verified" integer DEFAULT false NOT NULL, "name" text, "image" text, "max_organization_count" integer );+ CREATE TABLE "users" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "email" text NOT NULL, "email_verified" integer DEFAULT false NOT NULL, "name" text, "image" text, "max_organization_count" integer , "two_factor_enabled" integer DEFAULT false NOT NULL);CREATE TABLE "webhook_deliveries" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "webhook_id" text NOT NULL, "event_name" text NOT NULL, "request_payload" text NOT NULL, "response_payload" text NOT NULL, "response_status" integer NOT NULL, FOREIGN KEY ("webhook_id") REFERENCES "webhooks"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "webhook_events" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "webhook_id" text NOT NULL, "event_name" text NOT NULL, FOREIGN KEY ("webhook_id") REFERENCES "webhooks"("id") ON UPDATE cascade ON DELETE cascade );CREATE TABLE "webhooks" ( "id" text PRIMARY KEY NOT NULL, "created_at" integer NOT NULL, "updated_at" integer NOT NULL, "name" text NOT NULL, "url" text NOT NULL, "secret" text, "enabled" integer DEFAULT true NOT NULL, "created_by" text, "organization_id" text, FOREIGN KEY ("created_by") REFERENCES "users"("id") ON UPDATE cascade ON DELETE set null, FOREIGN KEY ("organization_id") REFERENCES "organizations"("id") ON UPDATE cascade ON DELETE cascade );"diff --git a/apps/papra-server/src/migrations/migrations.registry.ts b/apps/papra-server/src/migrations/migrations.registry.tsindex ccb2ebbc..4d670ce5 100644--- a/apps/papra-server/src/migrations/migrations.registry.ts+++ b/apps/papra-server/src/migrations/migrations.registry.ts@@ -9,13 +9,11 @@ import { organizationsInvitationsImprovementMigration } from './list/0006-organiimport { documentActivityLogMigration } from './list/0007-document-activity-log.migration';import { documentActivityLogOnDeleteSetNullMigration } from './list/0008-document-activity-log-on-delete-set-null.migration';import { dropLegacyMigrationsMigration } from './list/0009-drop-legacy-migrations.migration';-import { documentFileEncryptionMigration } from './list/0010-document-file-encryption.migration';-import { softDeleteOrganizationsMigration } from './list/0011-soft-delete-organizations.migration';import { taggingRuleConditionMatchModeMigration } from './list/0012-tagging-rule-condition-match-mode.migration';-import { dropFts5TriggersMigration } from './list/0013-drop-fts-5-triggers.migration';+import { twoFactorAuthenticationMigration } from './list/0014-two-factor-authentication.migration';export const migrations: Migration[] = [initialSchemaSetupMigration,@@ -31,4 +29,5 @@ export const migrations: Migration[] = [softDeleteOrganizationsMigration,taggingRuleConditionMatchModeMigration,dropFts5TriggersMigration,+ twoFactorAuthenticationMigration,];diff --git a/apps/papra-server/src/modules/app/auth/auth.services.ts b/apps/papra-server/src/modules/app/auth/auth.services.tsindex b0fbbad2..190597ba 100644--- a/apps/papra-server/src/modules/app/auth/auth.services.ts+++ b/apps/papra-server/src/modules/app/auth/auth.services.ts@@ -5,13 +5,13 @@ import type { AuthEmailsServices } from './auth.emails.services';import { expo } from '@better-auth/expo';import { betterAuth } from 'better-auth';import { drizzleAdapter } from 'better-auth/adapters/drizzle';-import { genericOAuth } from 'better-auth/plugins';+import { genericOAuth, twoFactor } from 'better-auth/plugins';import { getServerBaseUrl } from '../../config/config.models';import { createLogger } from '../../shared/logger/logger';import { usersTable } from '../../users/users.table';import { createForbiddenEmailDomainError } from './auth.errors';import { getTrustedOrigins, isEmailDomainAllowed } from './auth.models';-import { accountsTable, sessionsTable, verificationsTable } from './auth.tables';+import { accountsTable, sessionsTable, twoFactorTable, verificationsTable } from './auth.tables';export type Auth = ReturnType<typeof getAuth>['auth'];@@ -74,6 +74,7 @@ export function getAuth({account: accountsTable,session: sessionsTable,verification: verificationsTable,+ twoFactor: twoFactorTable,},},),@@ -127,26 +128,7 @@ export function getAuth({},plugins: [expo(),- // Would love to have this but it messes with the error handling in better-auth client- // {- // id: 'better-auth-error-adapter',- // onResponse: async (res) => {- // // Transform better auth error to our own error- // if (res.status < 400) {- // return { response: res };- // }-- // const body = await res.clone().json();- // const code = get(body, 'code', 'unknown');-- // throw createError({- // message: get(body, 'message', 'Unknown error'),- // code: `auth.${code.toLowerCase()}`,- // statusCode: res.status as ContentfulStatusCode,- // isInternal: res.status >= 500,- // });- // },- // },+ twoFactor(),...(config.auth.providers.customs.length > 0? [genericOAuth({ config: config.auth.providers.customs })]diff --git a/apps/papra-server/src/modules/app/auth/auth.tables.ts b/apps/papra-server/src/modules/app/auth/auth.tables.tsindex 2fc23874..e6f2072a 100644--- a/apps/papra-server/src/modules/app/auth/auth.tables.ts+++ b/apps/papra-server/src/modules/app/auth/auth.tables.ts@@ -56,3 +56,15 @@ export const verificationsTable = sqliteTable(index('auth_verifications_identifier_index').on(table.identifier),],);++export const twoFactorTable = sqliteTable(+ 'auth_two_factor',+ {+ ...createPrimaryKeyField({ prefix: 'auth_2fa' }),+ ...createTimestampColumns(),++ userId: text('user_id').references(() => usersTable.id, { onDelete: 'cascade', onUpdate: 'cascade' }),+ secret: text('secret'),+ backupCodes: text('backup_codes'),+ },+);diff --git a/apps/papra-server/src/modules/users/users.routes.ts b/apps/papra-server/src/modules/users/users.routes.tsindex 75f3a230..b96b84d0 100644--- a/apps/papra-server/src/modules/users/users.routes.ts+++ b/apps/papra-server/src/modules/users/users.routes.ts@@ -45,6 +45,7 @@ function setupGetCurrentUserRoute({ app, db }: RouteDefinitionContext) {'createdAt','updatedAt','planId',+ 'twoFactorEnabled',],),},diff --git a/apps/papra-server/src/modules/users/users.table.ts b/apps/papra-server/src/modules/users/users.table.tsindex 143a0c2c..695db813 100644--- a/apps/papra-server/src/modules/users/users.table.ts+++ b/apps/papra-server/src/modules/users/users.table.ts@@ -12,6 +12,7 @@ export const usersTable = sqliteTable(name: text('name'),image: text('image'),maxOrganizationCount: integer('max_organization_count', { mode: 'number' }),+ twoFactorEnabled: integer('two_factor_enabled', { mode: 'boolean' }).notNull().default(false),},table => [index('users_email_index').on(table.email),diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 52eb7958..3a9f21b7 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -134,7 +134,7 @@ importers:dependencies:'@better-auth/expo':specifier: 'catalog:'- version: 1.4.6(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected])([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected])))+ version: 1.4.6(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected])([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected])))'@corentinth/chisels':specifier: 'catalog:'version: 2.1.0@@ -283,6 +283,9 @@ importers:'@corentinth/chisels':specifier: 'catalog:'version: 2.1.0+ '@corvu/otp-field':+ specifier: ^0.1.4+ version: 0.1.4([email protected])'@kobalte/core':specifier: ^0.13.10version: 0.13.10([email protected])@@ -346,6 +349,9 @@ importers:unstorage:specifier: ^1.16.0version: 1.16.0(@azure/[email protected])([email protected])+ uqr:+ specifier: ^0.1.2+ version: 0.1.2valibot:specifier: 1.0.0-beta.10version: 1.0.0-beta.10([email protected])@@ -1797,6 +1803,11 @@ packages:'@corentinth/[email protected]':resolution: {integrity: sha512-NtOr6rEjsSp9bKUNkB0eAH04cFoXpiN9PmPLI0xEGq32g/qXlqp9vWHzr2Cc+Op8rHDjStuJxdWlD9iXTW7onA==}+ '@corvu/[email protected]':+ resolution: {integrity: sha512-3eG7OoUt6CfVqGujIYfqImdrhGR/s4DpKr5ZQT10zzw3nawIlcwVpqoHTam0v4cgv+NXXvl6I8DoA3J+WgW2YA==}+ peerDependencies:+ solid-js: ^1.8+'@corvu/[email protected]':resolution: {integrity: sha512-Ox2kYyxy7NoXdKWdHeDEjZxClwzO4SKM8plAaVwmAJPxHMqA0rLOoAsa+hBDwRLpctf+ZRnAd/ykguuJidnaTA==}peerDependencies:@@ -2817,10 +2828,6 @@ packages:resolution: {integrity: sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}- '@eslint/[email protected]':- resolution: {integrity: sha512-sB5uyeq+dwCWyPi31B2gQlVlo+j5brPlWx4yZBrEaRo/nhdDE8Xke1gsGgtiBdaBTxuTkceLVuVt/pclrasb0A==}- engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}-'@eslint/[email protected]':resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}@@ -11571,6 +11578,9 @@ packages:peerDependencies:browserslist: '>= 4.21.0'+ resolution: {integrity: sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA==}+resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}@@ -11866,6 +11876,7 @@ packages:resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}engines: {node: '>=18'}+ deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementationresolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==}@@ -13135,7 +13146,7 @@ snapshots:dependencies:'@babel/core': 7.28.4'@babel/helper-module-imports': 7.27.1- '@babel/helper-validator-identifier': 7.27.1+ '@babel/helper-validator-identifier': 7.28.5'@babel/traverse': 7.28.4transitivePeerDependencies:- supports-color@@ -13685,7 +13696,7 @@ snapshots:'@babel/[email protected]':dependencies:'@babel/helper-string-parser': 7.27.1- '@babel/helper-validator-identifier': 7.27.1+ '@babel/helper-validator-identifier': 7.28.5'@babel/[email protected]':dependencies:@@ -13707,7 +13718,7 @@ snapshots:nanostores: 1.0.1zod: 4.1.12- '@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])':+ '@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])':dependencies:'@better-auth/utils': 0.3.0'@better-fetch/fetch': 1.1.18@@ -13718,6 +13729,17 @@ snapshots:nanostores: 1.0.1zod: 4.1.12+ '@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])':+ dependencies:+ '@better-auth/utils': 0.3.0+ '@better-fetch/fetch': 1.1.18+ '@standard-schema/spec': 1.0.0+ better-call: 1.1.5([email protected])+ jose: 6.1.0+ kysely: 0.28.8+ nanostores: 1.0.1+ zod: 4.1.12+'@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected])([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected])))':dependencies:'@better-auth/core': 1.4.6(@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])@@ -13731,9 +13753,9 @@ snapshots:expo-network: 8.0.8([email protected])([email protected])expo-web-browser: 15.0.9([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected]))- '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected])([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected])))':+ '@better-auth/[email protected](@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])))([email protected])([email protected])([email protected]([email protected])([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native-community/[email protected]([email protected]))(@types/[email protected])([email protected])))':dependencies:- '@better-auth/core': 1.4.6(@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ '@better-auth/core': 1.4.6(@better-auth/[email protected])(@better-fetch/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])'@better-fetch/fetch': 1.1.18better-auth: 1.4.6([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))better-call: 1.1.5([email protected])@@ -13965,6 +13987,11 @@ snapshots:'@corentinth/[email protected]': {}+ '@corvu/[email protected]([email protected])':+ dependencies:+ '@corvu/utils': 0.4.2([email protected])+ solid-js: 1.9.9+'@corvu/[email protected]([email protected])':dependencies:'@floating-ui/dom': 1.6.13@@ -14555,7 +14582,7 @@ snapshots:'@eslint/[email protected]':dependencies:'@eslint/core': 0.16.0- '@eslint/plugin-kit': 0.4.0+ '@eslint/plugin-kit': 0.4.1github-slugger: 2.0.0mdast-util-from-markdown: 2.0.2mdast-util-frontmatter: 2.0.1@@ -14568,11 +14595,6 @@ snapshots:'@eslint/[email protected]': {}- '@eslint/[email protected]':- dependencies:- '@eslint/core': 0.16.0- levn: 0.4.1-'@eslint/[email protected]':dependencies:'@eslint/core': 0.17.0@@ -18632,7 +18654,7 @@ snapshots:'@better-fetch/fetch': 1.1.18'@noble/ciphers': 2.0.1'@noble/hashes': 2.0.1- better-call: 1.1.5([email protected])+ better-call: 1.1.5([email protected])defu: 6.1.4jose: 6.1.0kysely: 0.28.8@@ -20221,7 +20243,7 @@ snapshots:dependencies:'@babel/helper-validator-identifier': 7.28.5'@eslint-community/eslint-utils': 4.9.0([email protected]([email protected]))- '@eslint/plugin-kit': 0.4.0+ '@eslint/plugin-kit': 0.4.1change-case: 5.4.4ci-info: 4.3.1clean-regexp: 1.0.0@@ -25814,6 +25836,8 @@ snapshots:escalade: 3.2.0picocolors: 1.1.1+ [email protected]: {}+dependencies:punycode: 2.3.1