Skip to content

Correct flash after sending password reset email #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions models/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions routers/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/auth/forgot_passwd.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down