aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/main.go b/main.go
index 34667cf..86fd969 100644
--- a/main.go
+++ b/main.go
@@ -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, ""})
}
}