Debug: Ajouter logs détaillés pour authentification
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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user