summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2017-03-11 10:11:54 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-03-11 17:11:54 +0800
commit8a98a25d8e538d7ef026147b14b937beba2b1056 (patch)
tree4aafd6d6ff3a6e06d10cc5e0b57807df27a448d8 /routers/user
parentc99e7e1a62788b7bfdda1d3189a2b8c2254efa96 (diff)
downloadgitea-8a98a25d8e538d7ef026147b14b937beba2b1056.tar.gz
gitea-8a98a25d8e538d7ef026147b14b937beba2b1056.zip
Show a link to password reset from password change and delete account (#862)
It's helpful when you forgot your password thus cannot change it (can happen if you log in via OAuth2 or OpenID) Also make sure that both the delete-account and password-change links to forgot-password will have the primary email pre-filled
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/auth.go3
-rw-r--r--routers/user/setting.go3
2 files changed, 6 insertions, 0 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index ed8aac0de9..cb7d5961bd 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -872,6 +872,9 @@ func ForgotPasswd(ctx *context.Context) {
return
}
+ email := ctx.Query("email")
+ ctx.Data["Email"] = email
+
ctx.Data["IsResetRequest"] = true
ctx.HTML(200, tplForgotPassword)
}
diff --git a/routers/user/setting.go b/routers/user/setting.go
index 66ee680fb5..622f45f2c6 100644
--- a/routers/user/setting.go
+++ b/routers/user/setting.go
@@ -193,6 +193,7 @@ func SettingsDeleteAvatar(ctx *context.Context) {
func SettingsPassword(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
+ ctx.Data["Email"] = ctx.User.Email
ctx.HTML(200, tplSettingsPassword)
}
@@ -200,6 +201,7 @@ func SettingsPassword(ctx *context.Context) {
func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsPassword"] = true
+ ctx.Data["PageIsSettingsDelete"] = true
if ctx.HasError() {
ctx.HTML(200, tplSettingsPassword)
@@ -684,6 +686,7 @@ func SettingsDeleteAccountLink(ctx *context.Context) {
func SettingsDelete(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsDelete"] = true
+ ctx.Data["Email"] = ctx.User.Email
if ctx.Req.Method == "POST" {
if _, err := models.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil {