From cfff59473279eb4e22074c77dd5b806ad607a991 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 17 May 2026 20:51:06 +0200 Subject: [PATCH] feat(auth): frontend ErrorCode + i18n for INVALID_CREDENTIALS and SESSION_EXPIRED Mirrors the backend ErrorCode additions from commit 393a3c25. Adds error_session_expired_explainer for the login-page banner that will surface when ?reason=expired. Co-Authored-By: Claude Sonnet 4.6 --- frontend/messages/de.json | 3 +++ frontend/messages/en.json | 3 +++ frontend/messages/es.json | 3 +++ frontend/src/lib/shared/errors.ts | 6 ++++++ 4 files changed, 15 insertions(+) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 38067459..03d63f48 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -14,6 +14,9 @@ "error_file_too_large": "Die Datei ist zu groß (max. 50 MB).", "error_user_not_found": "Der Benutzer wurde nicht gefunden.", "error_import_already_running": "Ein Import läuft bereits. Bitte warten Sie, bis dieser abgeschlossen ist.", + "error_invalid_credentials": "E-Mail-Adresse oder Passwort ist falsch.", + "error_session_expired": "Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.", + "error_session_expired_explainer": "Aus Sicherheitsgründen werden Sitzungen nach 8 Stunden Inaktivität automatisch beendet.", "error_unauthorized": "Sie sind nicht angemeldet.", "error_forbidden": "Sie haben keine Berechtigung für diese Aktion.", "error_validation_error": "Die Eingabe ist ungültig.", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 2ecb565d..d52ddbf5 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -14,6 +14,9 @@ "error_file_too_large": "The file is too large (max. 50 MB).", "error_user_not_found": "User not found.", "error_import_already_running": "An import is already running. Please wait for it to finish.", + "error_invalid_credentials": "Email address or password is incorrect.", + "error_session_expired": "Your session has expired. Please sign in again.", + "error_session_expired_explainer": "For security reasons, sessions are automatically ended after 8 hours of inactivity.", "error_unauthorized": "You are not logged in.", "error_forbidden": "You do not have permission for this action.", "error_validation_error": "The input is invalid.", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index a68b663d..177dcdff 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -14,6 +14,9 @@ "error_file_too_large": "El archivo es demasiado grande (máx. 50 MB).", "error_user_not_found": "Usuario no encontrado.", "error_import_already_running": "Ya hay una importación en curso. Por favor, espere a que finalice.", + "error_invalid_credentials": "El correo electrónico o la contraseña son incorrectos.", + "error_session_expired": "Su sesión ha expirado. Por favor, inicie sesión de nuevo.", + "error_session_expired_explainer": "Por razones de seguridad, las sesiones se terminan automáticamente tras 8 horas de inactividad.", "error_unauthorized": "No ha iniciado sesión.", "error_forbidden": "No tiene permiso para realizar esta acción.", "error_validation_error": "La entrada no es válida.", diff --git a/frontend/src/lib/shared/errors.ts b/frontend/src/lib/shared/errors.ts index 9703bbd9..ab79487f 100644 --- a/frontend/src/lib/shared/errors.ts +++ b/frontend/src/lib/shared/errors.ts @@ -44,6 +44,8 @@ export type ErrorCode = | 'CIRCULAR_RELATIONSHIP' | 'DUPLICATE_RELATIONSHIP' | 'GESCHICHTE_NOT_FOUND' + | 'INVALID_CREDENTIALS' + | 'SESSION_EXPIRED' | 'MISSING_CREDENTIALS' | 'UNAUTHORIZED' | 'FORBIDDEN' @@ -154,6 +156,10 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string { return m.error_duplicate_relationship(); case 'GESCHICHTE_NOT_FOUND': return m.error_geschichte_not_found(); + case 'INVALID_CREDENTIALS': + return m.error_invalid_credentials(); + case 'SESSION_EXPIRED': + return m.error_session_expired(); case 'MISSING_CREDENTIALS': return m.login_error_missing_credentials(); case 'UNAUTHORIZED':