@@ -27,19 +27,19 @@ func Toggle(options *ToggleOptions) func(ctx *Context) {
2727 return func (ctx * Context ) {
2828 // Check prohibit login users.
2929 if ctx .IsSigned {
30- if ! ctx .User .IsActive && setting .Service .RegisterEmailConfirm {
30+ if ! ctx .Doer .IsActive && setting .Service .RegisterEmailConfirm {
3131 ctx .Data ["Title" ] = ctx .Tr ("auth.active_your_account" )
3232 ctx .HTML (http .StatusOK , "user/auth/activate" )
3333 return
3434 }
35- if ! ctx .User .IsActive || ctx .User .ProhibitLogin {
36- log .Info ("Failed authentication attempt for %s from %s" , ctx .User .Name , ctx .RemoteAddr ())
35+ if ! ctx .Doer .IsActive || ctx .Doer .ProhibitLogin {
36+ log .Info ("Failed authentication attempt for %s from %s" , ctx .Doer .Name , ctx .RemoteAddr ())
3737 ctx .Data ["Title" ] = ctx .Tr ("auth.prohibit_login" )
3838 ctx .HTML (http .StatusOK , "user/auth/prohibit_login" )
3939 return
4040 }
4141
42- if ctx .User .MustChangePassword {
42+ if ctx .Doer .MustChangePassword {
4343 if ctx .Req .URL .Path != "/user/settings/change_password" {
4444 ctx .Data ["Title" ] = ctx .Tr ("auth.must_change_password" )
4545 ctx .Data ["ChangePasscodeLink" ] = setting .AppSubURL + "/user/change_password"
@@ -76,7 +76,7 @@ func Toggle(options *ToggleOptions) func(ctx *Context) {
7676 }
7777 ctx .Redirect (setting .AppSubURL + "/user/login" )
7878 return
79- } else if ! ctx .User .IsActive && setting .Service .RegisterEmailConfirm {
79+ } else if ! ctx .Doer .IsActive && setting .Service .RegisterEmailConfirm {
8080 ctx .Data ["Title" ] = ctx .Tr ("auth.active_your_account" )
8181 ctx .HTML (http .StatusOK , "user/auth/activate" )
8282 return
@@ -94,7 +94,7 @@ func Toggle(options *ToggleOptions) func(ctx *Context) {
9494 }
9595
9696 if options .AdminRequired {
97- if ! ctx .User .IsAdmin {
97+ if ! ctx .Doer .IsAdmin {
9898 ctx .Error (http .StatusForbidden )
9999 return
100100 }
@@ -108,23 +108,23 @@ func ToggleAPI(options *ToggleOptions) func(ctx *APIContext) {
108108 return func (ctx * APIContext ) {
109109 // Check prohibit login users.
110110 if ctx .IsSigned {
111- if ! ctx .User .IsActive && setting .Service .RegisterEmailConfirm {
111+ if ! ctx .Doer .IsActive && setting .Service .RegisterEmailConfirm {
112112 ctx .Data ["Title" ] = ctx .Tr ("auth.active_your_account" )
113113 ctx .JSON (http .StatusForbidden , map [string ]string {
114114 "message" : "This account is not activated." ,
115115 })
116116 return
117117 }
118- if ! ctx .User .IsActive || ctx .User .ProhibitLogin {
119- log .Info ("Failed authentication attempt for %s from %s" , ctx .User .Name , ctx .RemoteAddr ())
118+ if ! ctx .Doer .IsActive || ctx .Doer .ProhibitLogin {
119+ log .Info ("Failed authentication attempt for %s from %s" , ctx .Doer .Name , ctx .RemoteAddr ())
120120 ctx .Data ["Title" ] = ctx .Tr ("auth.prohibit_login" )
121121 ctx .JSON (http .StatusForbidden , map [string ]string {
122122 "message" : "This account is prohibited from signing in, please contact your site administrator." ,
123123 })
124124 return
125125 }
126126
127- if ctx .User .MustChangePassword {
127+ if ctx .Doer .MustChangePassword {
128128 ctx .JSON (http .StatusForbidden , map [string ]string {
129129 "message" : "You must change your password. Change it at: " + setting .AppURL + "/user/change_password" ,
130130 })
@@ -145,7 +145,7 @@ func ToggleAPI(options *ToggleOptions) func(ctx *APIContext) {
145145 "message" : "Only signed in user is allowed to call APIs." ,
146146 })
147147 return
148- } else if ! ctx .User .IsActive && setting .Service .RegisterEmailConfirm {
148+ } else if ! ctx .Doer .IsActive && setting .Service .RegisterEmailConfirm {
149149 ctx .Data ["Title" ] = ctx .Tr ("auth.active_your_account" )
150150 ctx .HTML (http .StatusOK , "user/auth/activate" )
151151 return
@@ -154,7 +154,7 @@ func ToggleAPI(options *ToggleOptions) func(ctx *APIContext) {
154154 if skip , ok := ctx .Data ["SkipLocalTwoFA" ]; ok && skip .(bool ) {
155155 return // Skip 2FA
156156 }
157- twofa , err := auth .GetTwoFactorByUID (ctx .User .ID )
157+ twofa , err := auth .GetTwoFactorByUID (ctx .Doer .ID )
158158 if err != nil {
159159 if auth .IsErrTwoFactorNotEnrolled (err ) {
160160 return // No 2FA enrollment for this user
@@ -178,7 +178,7 @@ func ToggleAPI(options *ToggleOptions) func(ctx *APIContext) {
178178 }
179179
180180 if options .AdminRequired {
181- if ! ctx .User .IsAdmin {
181+ if ! ctx .Doer .IsAdmin {
182182 ctx .JSON (http .StatusForbidden , map [string ]string {
183183 "message" : "You have no permission to request for this." ,
184184 })
0 commit comments