mirror of
https://github.com/gogs/gogs.git
synced 2025-12-20 15:20:01 +01:00
Refactoring: rename Signed -> Logged
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user