mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix display dashboard even if require to change password (#6214)
* fix display dashboard even if require to change password * fix comments
This commit is contained in:
		@@ -44,21 +44,17 @@ func Toggle(options *ToggleOptions) macaron.Handler {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// prevent infinite redirection
 | 
			
		||||
			// also make sure that the form cannot be accessed by
 | 
			
		||||
			// users who don't need this
 | 
			
		||||
			if ctx.Req.URL.Path == "/user/settings/change_password" {
 | 
			
		||||
				if !ctx.User.MustChangePassword {
 | 
			
		||||
					ctx.Redirect(setting.AppSubURL + "/")
 | 
			
		||||
				}
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if ctx.User.MustChangePassword {
 | 
			
		||||
				ctx.Data["Title"] = ctx.Tr("auth.must_change_password")
 | 
			
		||||
				ctx.Data["ChangePasscodeLink"] = setting.AppSubURL + "/user/change_password"
 | 
			
		||||
				ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
 | 
			
		||||
				ctx.Redirect(setting.AppSubURL + "/user/settings/change_password")
 | 
			
		||||
				if ctx.Req.URL.Path != "/user/settings/change_password" {
 | 
			
		||||
					ctx.Data["Title"] = ctx.Tr("auth.must_change_password")
 | 
			
		||||
					ctx.Data["ChangePasscodeLink"] = setting.AppSubURL + "/user/change_password"
 | 
			
		||||
					ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL)
 | 
			
		||||
					ctx.Redirect(setting.AppSubURL + "/user/settings/change_password")
 | 
			
		||||
					return
 | 
			
		||||
				}
 | 
			
		||||
			} else if ctx.Req.URL.Path == "/user/settings/change_password" {
 | 
			
		||||
				// make sure that the form cannot be accessed by users who don't need this
 | 
			
		||||
				ctx.Redirect(setting.AppSubURL + "/")
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user