Debug: Ajouter logs détaillés pour authentification
All checks were successful
Build and Push Docker Images / Build Backend Image (push) Successful in 9m48s
Build and Push Docker Images / Build Frontend Image (push) Successful in 3m0s

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 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 17:20:58 +01:00
parent 16b3fdabed
commit 0fbfb6f8ed

View File

@@ -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