diff --git a/.gitignore b/.gitignore index 65fffc95..470d00d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ # Expo local state (in sub-projects) **/.expo/ -test_address.sh easpip ansible/ dist/ -frontend-prep2/ -scripts/data.txt -scripts/data2.txt -scripts/data3.txt diff --git a/backend/gestion/handlers/auth.go b/backend/gestion/handlers/auth.go index 6b351778..3bba4bb9 100644 --- a/backend/gestion/handlers/auth.go +++ b/backend/gestion/handlers/auth.go @@ -287,15 +287,18 @@ func LoginClient(c *gin.Context) { if linked { code := fmt.Sprintf("%06d", cryptoRandInt()%1000000) sessionToken := uuid.New().String() - if err := db.Store2FASession(sessionToken, client.Username, code); err == nil { - msg := fmt.Sprintf("🔐 Code de vérification : %s\n\nValable 5 minutes.", code) - services.TelegramBot.SendMessage(chatID, msg) - c.JSON(http.StatusOK, gin.H{ - "requires_2fa": true, - "session_token": sessionToken, - }) + if err := db.Store2FASession(sessionToken, client.Username, code); err != nil { + log.Printf("❌ [2FA] Erreur stockage session Redis: %v", err) + c.JSON(http.StatusInternalServerError, gin.H{"error": "Erreur interne"}) return } + msg := fmt.Sprintf("🔐 Code de vérification : %s\n\nValable 5 minutes.", code) + services.TelegramBot.SendMessage(chatID, msg) + c.JSON(http.StatusOK, gin.H{ + "requires_2fa": true, + "session_token": sessionToken, + }) + return } }