Skip to content

Commit

Permalink
small login fix
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-streltsov committed Sep 15, 2024
1 parent bc90f38 commit 112bbc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (h *Handler) loginHandler(w http.ResponseWriter, r *http.Request) {
password := r.FormValue("password")

user, err := h.db.GetUserByUsername(username)
if err != nil {
if err != nil || user == nil {
session.AddFlash("Invalid username or password", "error")
session.Save(r, w)
http.Redirect(w, r, "/login", http.StatusSeeOther)
Expand Down

0 comments on commit 112bbc5

Please sign in to comment.