feature (auth): follow param in redirect URL

This commit is contained in:
MickaelK 2025-01-15 02:56:21 +11:00
parent 28028f540c
commit 753e76d4af

View file

@ -387,6 +387,13 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
templateBind[key] = value
}
}
redirectURI := templateBind["next"]
if redirectURI == "" {
redirectURI = WithBase("/")
}
if templateBind["nav"] != "" {
redirectURI += "?nav=" + templateBind["nav"]
}
// Step3: create a backend connection object
session, err := func(tb map[string]string) (map[string]string, error) {
@ -456,10 +463,6 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
SendErrorResult(res, ErrNotValid)
return
}
redirectURI := templateBind["next"]
if redirectURI == "" {
redirectURI = WithBase("/")
}
http.SetCookie(res, applyCookieRules(&http.Cookie{ // TODO: deprecate SSOCookieName
Name: SSOCookieName,
Value: "",