From e214728725b304e92308f3c30235ec0d12dd5478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=96stanb=C3=A4ck?= Date: Sun, 14 May 2017 04:38:30 +0200 Subject: [PATCH] Add new text for reset password flash (#1718) * Forgot password should use ResetPwdCodeLives, not ActiveCodeLives * Improve documentation for different send mail functions related to password reset * Improve documentation in conf/app.ini regarding xxx_CODE_LIVE_MINUTES settings --- conf/app.ini | 2 ++ models/mail.go | 4 ++-- options/locale/locale_en-US.ini | 1 + routers/user/auth.go | 4 ++-- templates/user/auth/forgot_passwd.tmpl | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index 4f7dc9946..106e0ea2c 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -222,7 +222,9 @@ WHITELISTED_URIS = BLACKLISTED_URIS = [service] +; Time limit to confirm account/email registration (in multiples of 60 minutes) ACTIVE_CODE_LIVE_MINUTES = 180 +; Time limit to confirm forgot password reset process (in multiples of 60 minutes) RESET_PASSWD_CODE_LIVE_MINUTES = 180 ; User need to confirm e-mail for registration REGISTER_EMAIL_CONFIRM = false diff --git a/models/mail.go b/models/mail.go index 16e8c9e2e..20ddde0cd 100644 --- a/models/mail.go +++ b/models/mail.go @@ -65,7 +65,7 @@ func SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject, mailer.SendAsync(msg) } -// SendActivateAccountMail sends an activation mail to the user +// SendActivateAccountMail sends an activation mail to the user (new user registration) func SendActivateAccountMail(c *macaron.Context, u *User) { SendUserMail(c, u, mailAuthActivate, u.GenerateActivateCode(), c.Tr("mail.activate_account"), "activate account") } @@ -75,7 +75,7 @@ func SendResetPasswordMail(c *macaron.Context, u *User) { SendUserMail(c, u, mailAuthResetPassword, u.GenerateActivateCode(), c.Tr("mail.reset_password"), "reset password") } -// SendActivateEmailMail sends confirmation email. +// SendActivateEmailMail sends confirmation email to confirm new email address func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress) { data := map[string]interface{}{ "Username": u.DisplayName(), diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fbea0a101..8565b42a7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -171,6 +171,7 @@ forgot_password_title= Forgot Password forgot_password = Forgot password? sign_up_now = Need an account? Sign up now. confirmation_mail_sent_prompt = A new confirmation email has been sent to %s. Please check your inbox within the next %d hours to complete the registration process. +reset_password_mail_sent_prompt = A confirmation email has been sent to %s. Please check your inbox within the next %d hours to complete the password reset process. active_your_account = Activate Your Account prohibit_login = Login Prohibited prohibit_login_desc = Your account is prohibited to login, please contact the site administrator. diff --git a/routers/user/auth.go b/routers/user/auth.go index 68bfe6b05..856b47bdd 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -913,7 +913,7 @@ func ForgotPasswdPost(ctx *context.Context) { u, err := models.GetUserByEmail(email) if err != nil { if models.IsErrUserNotExist(err) { - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["Hours"] = setting.Service.ResetPwdCodeLives / 60 ctx.Data["IsResetSent"] = true ctx.HTML(200, tplForgotPassword) return @@ -940,7 +940,7 @@ func ForgotPasswdPost(ctx *context.Context) { log.Error(4, "Set cache(MailResendLimit) fail: %v", err) } - ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 + ctx.Data["Hours"] = setting.Service.ResetPwdCodeLives / 60 ctx.Data["IsResetSent"] = true ctx.HTML(200, tplForgotPassword) } diff --git a/templates/user/auth/forgot_passwd.tmpl b/templates/user/auth/forgot_passwd.tmpl index 86a98fcf1..412b5b884 100644 --- a/templates/user/auth/forgot_passwd.tmpl +++ b/templates/user/auth/forgot_passwd.tmpl @@ -10,7 +10,7 @@
{{template "base/alert" .}} {{if .IsResetSent}} -

{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .Email .Hours | Str2html}}

+

{{.i18n.Tr "auth.reset_password_mail_sent_prompt" .Email .Hours | Str2html}}

{{else if .IsResetRequest}}