Skip to content
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

Add better errors for disabled account recovery #15117

Merged
merged 3 commits into from
Jun 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new
openid_register_title = Create new account
openid_register_desc = The chosen OpenID URI is unknown. Associate it with a new account here.
openid_signin_desc = Enter your OpenID URI. For example: https://anne.me, bob.openid.org.cn or gnusocial.net/carry.
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
disable_forgot_password_mail = Account recovery is disabled because no email is set up. Please contact your site administrator.
disable_forgot_password_mail_admin = Account recovery is only available when email is set up. Please set up email to enable account recovery.
email_domain_blacklisted = You cannot register with your email address.
authorize_application = Authorize Application
authorize_redirect_notice = You will be redirected to %s if you authorize this application.
Expand All @@ -311,7 +312,6 @@ authorize_application_description = If you grant the access, it will be able to
authorize_title = Authorize "%s" to access your account?
authorization_failed = Authorization failed
authorization_failed_desc = The authorization failed because we detected an invalid request. Please contact the maintainer of the app you've tried to authorize.
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
sspi_auth_failed = SSPI authentication failed
password_pwned = The password you chose is on a <a target="_blank" rel="noopener noreferrer" href="https://haveibeenpwned.com/Passwords">list of stolen passwords</a> previously exposed in public data breaches. Please try again with a different password.
password_pwned_err = Could not complete request to HaveIBeenPwned
Expand Down
1 change: 1 addition & 0 deletions routers/web/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,7 @@ func ForgotPasswd(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title")

if setting.MailService == nil {
log.Warn(ctx.Tr("auth.disable_forgot_password_mail_admin"))
ctx.Data["IsResetDisable"] = true
ctx.HTML(http.StatusOK, tplForgotPassword)
return
Expand Down
8 changes: 7 additions & 1 deletion templates/user/auth/forgot_passwd.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
<button class="ui blue button">{{.i18n.Tr "auth.send_reset_mail"}}</button>
</div>
{{else if .IsResetDisable}}
<p class="center">{{.i18n.Tr "auth.disable_forgot_password_mail"}}</p>
<p class="center">
{{if $.IsAdmin}}
jolheiser marked this conversation as resolved.
Show resolved Hide resolved
{{.i18n.Tr "auth.disable_forgot_password_mail_admin"}}
{{else}}
{{.i18n.Tr "auth.disable_forgot_password_mail"}}
{{end}}
</p>
{{else if .ResendLimited}}
<p class="center">{{.i18n.Tr "auth.resent_limit_prompt"}}</p>
{{end}}
Expand Down