diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-02-06 16:17:17 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-02-06 16:17:17 -0800 |
| commit | cf9e3f0f753e69c5bfa0838787e1c9833a060646 (patch) | |
| tree | eb93827bc0633864307777c2bdaeae69065da1b5 /roseh.moe.go | |
| parent | b7b59ca3096215b623e27ac943e6d40d9532fc6b (diff) | |
| download | roseh.moe-cf9e3f0f753e69c5bfa0838787e1c9833a060646.tar.zst | |
Keep redirect query param on incorrect password
This makes it a little less weird when you enter an incorrect password
and the URL changes.
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/roseh.moe.go b/roseh.moe.go index f385899..cd443a6 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -554,8 +554,7 @@ var ( ) type loginTemplateArgs struct { - Redirect string - Error bool + Error bool } func redirectLogin(w http.ResponseWriter, r *http.Request, redirect string) { @@ -564,7 +563,7 @@ func redirectLogin(w http.ResponseWriter, r *http.Request, redirect string) { } func serveLogin(w http.ResponseWriter, r *http.Request) { - if err := loginTemplate.Execute(w, loginTemplateArgs{Redirect: r.FormValue("redirect")}); err != nil { + if err := loginTemplate.Execute(w, loginTemplateArgs{}); err != nil { log.Printf("Warning: login: %s", err) } } @@ -587,10 +586,7 @@ func verifyRedirect(redirect string) (string, bool) { func login(w http.ResponseWriter, r *http.Request) { if !checkPassword(r.FormValue("password"), r.FormValue("auth")) { - if err := loginTemplate.Execute(w, loginTemplateArgs{ - Redirect: r.FormValue("redirect"), - Error: true, - }); err != nil { + if err := loginTemplate.Execute(w, loginTemplateArgs{Error: true}); err != nil { log.Printf("Warning: login: %s", err) } return |
