From e031dad1e78b5ec434fac143e4bc716a82efeae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Fri, 22 Dec 2017 16:30:17 -0800 Subject: [PATCH] Fill login form on failed sign in --- server/template/html/login.html | 4 ++-- server/template/views.go | 8 ++++---- server/ui/controller/login.go | 1 + storage/user.go | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/template/html/login.html b/server/template/html/login.html index f692723b..906458ac 100644 --- a/server/template/html/login.html +++ b/server/template/html/login.html @@ -10,10 +10,10 @@ {{ end }} - + - +
diff --git a/server/template/views.go b/server/template/views.go index 0cdb20a3..86f28a9d 100644 --- a/server/template/views.go +++ b/server/template/views.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2017-12-22 11:25:01.96909666 -0800 PST m=+0.034064422 +// 2017-12-22 16:02:42.156291192 -0800 PST m=+0.011241908 package template @@ -974,10 +974,10 @@ var templateViewsMap = map[string]string{ {{ end }} - + - +
@@ -1336,7 +1336,7 @@ var templateViewsMapChecksums = map[string]string{ "history": "abc7ea29f7d54f28f73fe14979bbd03dbc41fa6a7c86f95f56d6e94f7b09b9ba", "import": "73b5112e20bfd232bf73334544186ea419505936bc237d481517a8622901878f", "integrations": "3c14d7de904911aad7f3ebec6d1a20b50843287f58125c526e167f429f3d455d", - "login": "04f3ce79bfa5753f69e0d956c2a8999c0da549c7925634a3e8134975da0b0e0f", + "login": "7d83c3067c02f1f6aafdd8816c7f97a4eb5a5a4bdaaaa4cc1e2fbb9c17ea65e8", "sessions": "878dbe8f8ea783b44130c495814179519fa5c3aa2666ac87508f94d58dd008bf", "settings": "ea2505b9d0a6d6bb594dba87a92079de19baa6d494f0651693a7685489fb7de9", "starred": "33dd40d1a24739e9d05f9cc4b66497cfdb8c86a7abb209a66ca65c2fbafc7d87", diff --git a/server/ui/controller/login.go b/server/ui/controller/login.go index 87b8a4ed..da9531e7 100644 --- a/server/ui/controller/login.go +++ b/server/ui/controller/login.go @@ -31,6 +31,7 @@ func (c *Controller) CheckLogin(ctx *core.Context, request *core.Request, respon tplParams := tplParams{ "errorMessage": "Invalid username or password.", "csrf": ctx.CSRF(), + "form": authForm, } if err := authForm.Validate(); err != nil { diff --git a/storage/user.go b/storage/user.go index d1275cc8..06a50e2c 100644 --- a/storage/user.go +++ b/storage/user.go @@ -338,7 +338,7 @@ func (s *Storage) CheckPassword(username, password string) error { } if err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)); err != nil { - return fmt.Errorf("invalid password for %s", username) + return fmt.Errorf(`invalid password for "%s" (%v)`, username, err) } return nil