mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Write the redirect cookie if denied - do not write a blank redirect (#57381)
* Write the redirect cookie if denied - do not write a blank redirect * Remove redundant code, reverse polarity
This commit is contained in:
parent
98053cfde8
commit
5d7d54d076
@ -64,9 +64,12 @@ func writeRedirectCookie(c *models.ReqContext) {
|
||||
redirectTo = setting.AppSubUrl + c.Req.RequestURI
|
||||
}
|
||||
|
||||
if redirectTo == "/" {
|
||||
return
|
||||
}
|
||||
|
||||
// remove any forceLogin=true params
|
||||
redirectTo = removeForceLoginParams(redirectTo)
|
||||
|
||||
cookies.WriteCookie(c.Resp, "redirect_to", url.QueryEscape(redirectTo), 0, nil)
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,7 @@ func deny(c *models.ReqContext, evaluator Evaluator, err error) {
|
||||
|
||||
if !c.IsApiRequest() {
|
||||
// TODO(emil): I'd like to show a message after this redirect, not sure how that can be done?
|
||||
writeRedirectCookie(c)
|
||||
c.Redirect(setting.AppSubUrl + "/")
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user