소스 검색

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
tags/v1.2.0-rc1
Jonas Östanbäck 7 년 전
부모
커밋
e214728725
5개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 2
    0
      conf/app.ini
  2. 2
    2
      models/mail.go
  3. 1
    0
      options/locale/locale_en-US.ini
  4. 2
    2
      routers/user/auth.go
  5. 1
    1
      templates/user/auth/forgot_passwd.tmpl

+ 2
- 0
conf/app.ini 파일 보기

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

+ 2
- 2
models/mail.go 파일 보기

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")
} }
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(),

+ 1
- 0
options/locale/locale_en-US.ini 파일 보기

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.

+ 2
- 2
routers/user/auth.go 파일 보기

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

+ 1
- 1
templates/user/auth/forgot_passwd.tmpl 파일 보기

<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…
취소
저장