summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-02-28 16:01:42 +0800
committerGitHub <noreply@github.com>2019-02-28 16:01:42 +0800
commitc812ba7f8745c981b341adb023c5ed6902f4622b (patch)
tree797c0b91f979f9f16b3e457e8e7eb19495bab743 /modules
parent48c101affe78396db89caada28f883ef5fac20a6 (diff)
downloadgitea-c812ba7f8745c981b341adb023c5ed6902f4622b.tar.gz
gitea-c812ba7f8745c981b341adb023c5ed6902f4622b.zip
fix display dashboard even if require to change password (#6214)
* fix display dashboard even if require to change password * fix comments
Diffstat (limited to 'modules')
-rw-r--r--modules/context/auth.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/modules/context/auth.go b/modules/context/auth.go
index 5a4d351dc4..9d9bd81c75 100644
--- a/modules/context/auth.go
+++ b/modules/context/auth.go
@@ -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
}
}