From 0fbfb6f8edb2f169874c628da79a88595870c190 Mon Sep 17 00:00:00 2001 From: Benoit Date: Fri, 26 Dec 2025 17:20:58 +0100 Subject: [PATCH] =?UTF-8?q?Debug:=20Ajouter=20logs=20d=C3=A9taill=C3=A9s?= =?UTF-8?q?=20pour=20authentification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problème: Login échoue avec 401, besoin de debug Ajout logs INFO pour: - Email fourni vs attendu - Comparaison email - Longueur des mots de passe - Résultat authentification À retirer en production une fois le problème résolu. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/src/core/auth.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/core/auth.py b/backend/src/core/auth.py index 354a004..62c6567 100644 --- a/backend/src/core/auth.py +++ b/backend/src/core/auth.py @@ -100,13 +100,22 @@ def authenticate_user(email: str, password: str) -> Optional[dict]: Returns: User data if authenticated, None otherwise """ + # Debug logging (remove in production) + logger.info(f"Auth attempt - Email provided: '{email}'") + logger.info(f"Auth attempt - Expected email: '{settings.ADMIN_EMAIL}'") + logger.info(f"Auth attempt - Email match: {email == settings.ADMIN_EMAIL}") + logger.info(f"Auth attempt - Password length: {len(password)}") + logger.info(f"Auth attempt - Expected password length: {len(settings.ADMIN_PASSWORD)}") + # Check against admin credentials from environment if email == settings.ADMIN_EMAIL and password == settings.ADMIN_PASSWORD: + logger.info(f"✅ Authentication successful for {email}") return { "email": email, "role": "admin" } + logger.warning(f"❌ Authentication failed for {email}") return None