diff options
Diffstat (limited to 'pkg/context/auth.go')
-rw-r--r-- | pkg/context/auth.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/context/auth.go b/pkg/context/auth.go index d2bfe603..9ad5cdd0 100644 --- a/pkg/context/auth.go +++ b/pkg/context/auth.go @@ -30,20 +30,20 @@ func Toggle(options *ToggleOptions) macaron.Handler { } // Check prohibit login users. - if ctx.IsSigned && ctx.User.ProhibitLogin { + if ctx.IsLogged && ctx.User.ProhibitLogin { ctx.Data["Title"] = ctx.Tr("auth.prohibit_login") ctx.HTML(200, "user/auth/prohibit_login") return } // Check non-logged users landing page. - if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME { + if !ctx.IsLogged && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME { ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL)) return } // Redirect to dashboard if user tries to visit any non-login page. - if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" { + if options.SignOutRequired && ctx.IsLogged && ctx.Req.RequestURI != "/" { ctx.Redirect(setting.AppSubURL + "/") return } @@ -56,7 +56,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { } if options.SignInRequired { - if !ctx.IsSigned { + if !ctx.IsLogged { // Restrict API calls with error message. if auth.IsAPIPath(ctx.Req.URL.Path) { ctx.JSON(403, map[string]string{ @@ -76,7 +76,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { } // Redirect to log in page if auto-signin info is provided and has not signed in. - if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && + if !options.SignOutRequired && !ctx.IsLogged && !auth.IsAPIPath(ctx.Req.URL.Path) && len(ctx.GetCookie(setting.CookieUserName)) > 0 { ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL) ctx.Redirect(setting.AppSubURL + "/user/login") |