make sure users that don't have to view the form get redirected
This commit is contained in:
parent
7e67ecc16a
commit
59432fae0a
|
@ -40,9 +40,16 @@ func Toggle(options *ToggleOptions) macaron.Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent infinite redirection
|
// prevent infinite redirection
|
||||||
|
// also make sure that the form cannot be accessed by
|
||||||
|
// users who don't need this
|
||||||
if ctx.Req.URL.Path == setting.AppSubURL+"/user/change_password" {
|
if ctx.Req.URL.Path == setting.AppSubURL+"/user/change_password" {
|
||||||
|
if !ctx.User.MustChangePassword {
|
||||||
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else if ctx.User.MustChangePassword {
|
}
|
||||||
|
|
||||||
|
if ctx.User.MustChangePassword {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.must_change_password")
|
ctx.Data["Title"] = ctx.Tr("auth.must_change_password")
|
||||||
ctx.Data["ChangePasscodeLink"] = setting.AppSubURL + "/user/change_password"
|
ctx.Data["ChangePasscodeLink"] = setting.AppSubURL + "/user/change_password"
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/change_password")
|
ctx.Redirect(setting.AppSubURL + "/user/change_password")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user