summaryrefslogtreecommitdiffstats
path: root/routers/home.go
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 /routers/home.go
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 'routers/home.go')
-rw-r--r--routers/home.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/home.go b/routers/home.go
index bea0139111..437c569a79 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -7,6 +7,7 @@ package routers
import (
"bytes"
+ "net/url"
"strings"
"code.gitea.io/gitea/models"
@@ -44,6 +45,11 @@ func Home(ctx *context.Context) {
log.Info("Failed authentication attempt for %s from %s", ctx.User.Name, ctx.RemoteAddr())
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
ctx.HTML(200, "user/auth/prohibit_login")
+ } else 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")
} else {
user.Dashboard(ctx)
}