From cf9e3f0f753e69c5bfa0838787e1c9833a060646 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Fri, 6 Feb 2026 16:17:17 -0800 Subject: Keep redirect query param on incorrect password This makes it a little less weird when you enter an incorrect password and the URL changes. --- assets/point.webp | Bin 0 -> 99366 bytes assets/point.xcf | Bin 14646 -> 45072 bytes roseh.moe.go | 10 +++------- static/point.webp | Bin 6078 -> 17478 bytes templates/login.html.template | 5 ++--- 5 files changed, 5 insertions(+), 10 deletions(-) create mode 100644 assets/point.webp diff --git a/assets/point.webp b/assets/point.webp new file mode 100644 index 0000000..8c7405d Binary files /dev/null and b/assets/point.webp differ diff --git a/assets/point.xcf b/assets/point.xcf index 80e0ed5..bfef35c 100644 Binary files a/assets/point.xcf and b/assets/point.xcf differ 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 diff --git a/static/point.webp b/static/point.webp index 501e647..c9b732a 100644 Binary files a/static/point.webp and b/static/point.webp differ diff --git a/templates/login.html.template b/templates/login.html.template index e9ffe2b..1aef0f2 100644 --- a/templates/login.html.template +++ b/templates/login.html.template @@ -4,8 +4,7 @@ {{if .Error}}

Incorrect password

{{end}} -
- + @@ -17,7 +16,7 @@ - +
-- cgit v1.3.1