Small improvement to dashboard loading error handling

This commit is contained in:
Torkel Ödegaard
2015-03-31 14:03:01 +02:00
parent aa724fc11e
commit b83367063e
2 changed files with 9 additions and 9 deletions

View File

@@ -42,6 +42,7 @@ func authDenied(c *Context) {
return
}
c.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+c.Req.RequestURI), 0, setting.AppSubUrl+"/")
c.Redirect(setting.AppSubUrl + "/login")
}
@@ -63,13 +64,11 @@ func RoleAuth(roles ...m.RoleType) macaron.Handler {
func Auth(options *AuthOptions) macaron.Handler {
return func(c *Context) {
if !c.IsGrafanaAdmin && options.ReqGrafanaAdmin {
c.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+c.Req.RequestURI), 0, setting.AppSubUrl+"/")
authDenied(c)
return
}
if !c.IsSignedIn && options.ReqSignedIn && !c.AllowAnonymous {
c.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+c.Req.RequestURI), 0, setting.AppSubUrl+"/")
authDenied(c)
return
}