diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -75,15 +75,23 @@ func (app *App) loginHandler(w http.ResponseWriter, r *http.Request) { http.SetCookie(w, &c) http.Redirect(w, r, next, http.StatusSeeOther) } else { + var flash string + if !ok { + flash = "Utilisateur non enregistré" + } else if subtle.ConstantTimeCompare(u.Password, hash) != 1 { + flash = "Mot de passe incorrect" + } app.Template.ExecuteTemplate(w, "login.tmpl", struct { - Next string - }{next}) + Next string + Flash string + }{next, flash}) } } else if r.Method == http.MethodGet { next := r.FormValue("next") app.Template.ExecuteTemplate(w, "login.tmpl", struct { - Next string - }{next}) + Next string + Flash string + }{next, ""}) } } |
