Pārlūkot izejas kodu

Fix false login state on failed login

Previously, a failed login would change the site-wide navigation so that
it looked like the user was logged in, even though they weren't. This
fixes that.
pull/157/head
Matt Baer pirms 4 gadiem
vecāks
revīzija
4419632f83
2 mainītis faili ar 6 papildinājumiem un 6 dzēšanām
  1. +4
    -4
      account.go
  2. +2
    -2
      pages/login.tmpl

+ 4
- 4
account.go Parādīt failu

@@ -309,10 +309,10 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error {

p := &struct {
page.StaticPage
To string
Message template.HTML
Flashes []template.HTML
Username string
To string
Message template.HTML
Flashes []template.HTML
LoginUsername string
}{
pageForReq(app, r),
r.FormValue("to"),


+ 2
- 2
pages/login.tmpl Parādīt failu

@@ -12,8 +12,8 @@
</ul>{{end}}

<form action="/auth/login" method="post" style="text-align: center;margin-top:1em;" onsubmit="disableSubmit()">
<input type="text" name="alias" placeholder="Username" value="{{.Username}}" {{if not .Username}}autofocus{{end}} /><br />
<input type="password" name="pass" placeholder="Password" {{if .Username}}autofocus{{end}} /><br />
<input type="text" name="alias" placeholder="Username" value="{{.LoginUsername}}" {{if not .LoginUsername}}autofocus{{end}} /><br />
<input type="password" name="pass" placeholder="Password" {{if .LoginUsername}}autofocus{{end}} /><br />
{{if .To}}<input type="hidden" name="to" value="{{.To}}" />{{end}}
<input type="submit" id="btn-login" value="Login" />
</form>


Notiek ielāde…
Atcelt
Saglabāt