We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 28b899c + a55612e commit f7f58b6Copy full SHA for f7f58b6
internal/controllers/auth.go
@@ -92,13 +92,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
92
return
93
}
94
95
- if user.Password != req.Password {
96
- logger.Errof("Invalid password for user: %s", user.Email)
97
- httphelpers.WriteError(w, http.StatusUnauthorized, "invalid credentials")
98
- return
99
- }
100
-
101
- if err := bcrypt.CompareHashAndPassword([]byte(req.Password), []byte(user.Password)); err != nil {
+ if err := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(req.Password)); err != nil {
102
if errors.Is(err, bcrypt.ErrMismatchedHashAndPassword) {
103
httphelpers.WriteJSON(w, http.StatusBadRequest, map[string]string{
104
"message": "invalid password",
0 commit comments