mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
feature (auth): follow param in redirect URL
This commit is contained in:
parent
28028f540c
commit
753e76d4af
1 changed files with 7 additions and 4 deletions
|
|
@ -387,6 +387,13 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
|
||||||
templateBind[key] = value
|
templateBind[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
redirectURI := templateBind["next"]
|
||||||
|
if redirectURI == "" {
|
||||||
|
redirectURI = WithBase("/")
|
||||||
|
}
|
||||||
|
if templateBind["nav"] != "" {
|
||||||
|
redirectURI += "?nav=" + templateBind["nav"]
|
||||||
|
}
|
||||||
|
|
||||||
// Step3: create a backend connection object
|
// Step3: create a backend connection object
|
||||||
session, err := func(tb map[string]string) (map[string]string, error) {
|
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)
|
SendErrorResult(res, ErrNotValid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
redirectURI := templateBind["next"]
|
|
||||||
if redirectURI == "" {
|
|
||||||
redirectURI = WithBase("/")
|
|
||||||
}
|
|
||||||
http.SetCookie(res, applyCookieRules(&http.Cookie{ // TODO: deprecate SSOCookieName
|
http.SetCookie(res, applyCookieRules(&http.Cookie{ // TODO: deprecate SSOCookieName
|
||||||
Name: SSOCookieName,
|
Name: SSOCookieName,
|
||||||
Value: "",
|
Value: "",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue