diff --git a/internal/app/handlers.go b/internal/app/handlers.go index 77c6f20..0cd6ffb 100644 --- a/internal/app/handlers.go +++ b/internal/app/handlers.go @@ -55,7 +55,12 @@ func (rm *TaskManager) handleLogin(w http.ResponseWriter, r *http.Request) { } user, err := rm.repo.GetUser(input.Name) - if err != nil || user.Password != persistance.GetMD5Hash(input.Password) { + if err != nil { + respondWithError(w, http.StatusUnauthorized, "Faild get user", err) + return + } + + if user.Password != persistance.GetMD5Hash(input.Password) { respondWithError(w, http.StatusUnauthorized, "Invalid username or password", errors.New("authentication failed")) return }