summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Östanbäck <cez81@users.noreply.github.com>2017-05-14 04:38:30 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-14 10:38:30 +0800
commite214728725b304e92308f3c30235ec0d12dd5478 (patch)
tree4693ca1691d8a760db1dc3fd78defa231b0faf8f
parent9e627af9a449419bcec65ccff1dba00abc625d43 (diff)
downloadgitea-e214728725b304e92308f3c30235ec0d12dd5478.tar.gz
gitea-e214728725b304e92308f3c30235ec0d12dd5478.zip
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
-rw-r--r--conf/app.ini2
-rw-r--r--models/mail.go4
-rw-r--r--options/locale/locale_en-US.ini1
-rw-r--r--routers/user/auth.go4
-rw-r--r--templates/user/auth/forgot_passwd.tmpl2
5 files changed, 8 insertions, 5 deletions
diff --git a/conf/app.ini b/conf/app.ini
index 4f7dc9946b..106e0ea2c2 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 16e8c9e2ef..20ddde0cd0 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 fbea0a101e..8565b42a75 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 <b>%s</b>. 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 <b>%s</b>. 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 68bfe6b05c..856b47bdd1 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 86a98fcf10..412b5b8847 100644
--- a/templates/user/auth/forgot_passwd.tmpl
+++ b/templates/user/auth/forgot_passwd.tmpl
@@ -10,7 +10,7 @@
<div class="ui attached segment">
{{template "base/alert" .}}
{{if .IsResetSent}}
- <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .Email .Hours | Str2html}}</p>
+ <p>{{.i18n.Tr "auth.reset_password_mail_sent_prompt" .Email .Hours | Str2html}}</p>
{{else if .IsResetRequest}}
<div class="required inline field {{if .Err_Email}}error{{end}}">
<label for="email">{{.i18n.Tr "email"}}</label>