Skip to content

Commit f7f58b6

Browse files
authored
Merge branch 'CodeChefVIT:master' into main
2 parents 28b899c + a55612e commit f7f58b6

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

internal/controllers/auth.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,7 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
9292
return
9393
}
9494

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 {
95+
if err := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(req.Password)); err != nil {
10296
if errors.Is(err, bcrypt.ErrMismatchedHashAndPassword) {
10397
httphelpers.WriteJSON(w, http.StatusBadRequest, map[string]string{
10498
"message": "invalid password",

0 commit comments

Comments
 (0)