Skip to content
Snippets Groups Projects

Improve handling of the "next URL" request parameter

Merged ale requested to merge fix-next-url into master
6 files
+ 56
15
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 2
2
@@ -71,7 +71,7 @@ func (m *loginMiddleware) Wrap(wrap http.Handler, renderer *common.Renderer) htt
mux.HandleFunc(m.urls.URLFor("/login/"), func(w http.ResponseWriter, req *http.Request) {
var auth Auth
if m.authSessionStore.getSession(req, &auth) == nil && auth.check() == nil {
redirURL := req.FormValue("r")
redirURL := req.FormValue(nextURLParamName)
http.Redirect(w, req, redirURL, http.StatusFound)
return
}
@@ -110,7 +110,7 @@ func (m *loginMiddleware) Wrap(wrap http.Handler, renderer *common.Renderer) htt
// Redirect to login workflow.
values := make(url.Values)
values.Set("r", req.URL.String())
values.Set(nextURLParamName, req.URL.String())
http.Redirect(w, req, m.urls.URLFor("/login/?"+values.Encode()), http.StatusFound)
})
Loading