diff options
Diffstat (limited to 'pkg/view')
-rw-r--r-- | pkg/view/auth.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/view/auth.go b/pkg/view/auth.go index 1b87235..8d87035 100644 --- a/pkg/view/auth.go +++ b/pkg/view/auth.go @@ -2,6 +2,7 @@ package view import ( "encoding/base64" + "errors" "net/http" "git.sr.ht/~gabrielgio/img/pkg/ext" @@ -45,6 +46,15 @@ func (v *AuthView) Login(w http.ResponseWriter, r *http.Request) error { ) auth, err := v.userController.Login(r.Context(), username, password) + + if errors.Is(err, service.InvalidLogin) { + templates.WritePageTemplate(w, &templates.LoginPage{ + Username: r.FormValue("username"), + Err: err.Error(), + }) + return nil + } + if err != nil { return err } |