Fill login form on failed sign in

This commit is contained in:
Frédéric Guillot 2017-12-22 16:30:17 -08:00
parent 9868f900e9
commit e031dad1e7
4 changed files with 8 additions and 7 deletions

View file

@ -10,10 +10,10 @@
{{ end }}
<label for="form-username">{{ t "Username" }}</label>
<input type="text" name="username" id="form-username" required autofocus>
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
<label for="form-password">{{ t "Password" }}</label>
<input type="password" name="password" id="form-password" required>
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" required>
<div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button>

View file

@ -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 }}
<label for="form-username">{{ t "Username" }}</label>
<input type="text" name="username" id="form-username" required autofocus>
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
<label for="form-password">{{ t "Password" }}</label>
<input type="password" name="password" id="form-password" required>
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" required>
<div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button>
@ -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",

View file

@ -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 {

View file

@ -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