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
tokarchuk/v1.17
Jonas Östanbäck 8 years ago committed by Lunny Xiao
parent 9e627af9a4
commit e214728725
  1. 2
      conf/app.ini
  2. 4
      models/mail.go
  3. 1
      options/locale/locale_en-US.ini
  4. 4
      routers/user/auth.go
  5. 2
      templates/user/auth/forgot_passwd.tmpl

2
conf/app.ini vendored

@ -222,7 +222,9 @@ WHITELISTED_URIS =
BLACKLISTED_URIS = BLACKLISTED_URIS =
[service] [service]
; Time limit to confirm account/email registration (in multiples of 60 minutes)
ACTIVE_CODE_LIVE_MINUTES = 180 ACTIVE_CODE_LIVE_MINUTES = 180
; Time limit to confirm forgot password reset process (in multiples of 60 minutes)
RESET_PASSWD_CODE_LIVE_MINUTES = 180 RESET_PASSWD_CODE_LIVE_MINUTES = 180
; User need to confirm e-mail for registration ; User need to confirm e-mail for registration
REGISTER_EMAIL_CONFIRM = false REGISTER_EMAIL_CONFIRM = false

@ -65,7 +65,7 @@ func SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject,
mailer.SendAsync(msg) 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) { func SendActivateAccountMail(c *macaron.Context, u *User) {
SendUserMail(c, u, mailAuthActivate, u.GenerateActivateCode(), c.Tr("mail.activate_account"), "activate account") 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") 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) { func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress) {
data := map[string]interface{}{ data := map[string]interface{}{
"Username": u.DisplayName(), "Username": u.DisplayName(),

@ -171,6 +171,7 @@ forgot_password_title= Forgot Password
forgot_password = Forgot password? forgot_password = Forgot password?
sign_up_now = Need an account? Sign up now. 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. 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 active_your_account = Activate Your Account
prohibit_login = Login Prohibited prohibit_login = Login Prohibited
prohibit_login_desc = Your account is prohibited to login, please contact the site administrator. prohibit_login_desc = Your account is prohibited to login, please contact the site administrator.

@ -913,7 +913,7 @@ func ForgotPasswdPost(ctx *context.Context) {
u, err := models.GetUserByEmail(email) u, err := models.GetUserByEmail(email)
if err != nil { if err != nil {
if models.IsErrUserNotExist(err) { if models.IsErrUserNotExist(err) {
ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 ctx.Data["Hours"] = setting.Service.ResetPwdCodeLives / 60
ctx.Data["IsResetSent"] = true ctx.Data["IsResetSent"] = true
ctx.HTML(200, tplForgotPassword) ctx.HTML(200, tplForgotPassword)
return return
@ -940,7 +940,7 @@ func ForgotPasswdPost(ctx *context.Context) {
log.Error(4, "Set cache(MailResendLimit) fail: %v", err) 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.Data["IsResetSent"] = true
ctx.HTML(200, tplForgotPassword) ctx.HTML(200, tplForgotPassword)
} }

@ -10,7 +10,7 @@
<div class="ui attached segment"> <div class="ui attached segment">
{{template "base/alert" .}} {{template "base/alert" .}}
{{if .IsResetSent}} {{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}} {{else if .IsResetRequest}}
<div class="required inline field {{if .Err_Email}}error{{end}}"> <div class="required inline field {{if .Err_Email}}error{{end}}">
<label for="email">{{.i18n.Tr "email"}}</label> <label for="email">{{.i18n.Tr "email"}}</label>

Loading…
Cancel
Save