1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

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
This commit is contained in:
Jonas Östanbäck 2017-05-14 04:38:30 +02:00 committed by Lunny Xiao
parent 9e627af9a4
commit e214728725
5 changed files with 8 additions and 5 deletions

2
conf/app.ini vendored
View file

@ -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

View file

@ -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(),

View file

@ -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.

View file

@ -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)
}

View file

@ -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>