Skip to content

Commit 622f1e7

Browse files
jolheiserzeripath6543
authored
Add better errors for disabled account recovery (#15117)
Signed-off-by: jolheiser <[email protected]> Co-authored-by: Andrew Thornton <[email protected]> Co-authored-by: 6543 <[email protected]>
1 parent 62a4879 commit 622f1e7

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

options/locale/locale_en-US.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new
303303
openid_register_title = Create new account
304304
openid_register_desc = The chosen OpenID URI is unknown. Associate it with a new account here.
305305
openid_signin_desc = Enter your OpenID URI. For example: https://anne.me, bob.openid.org.cn or gnusocial.net/carry.
306-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
306+
disable_forgot_password_mail = Account recovery is disabled because no email is set up. Please contact your site administrator.
307+
disable_forgot_password_mail_admin = Account recovery is only available when email is set up. Please set up email to enable account recovery.
307308
email_domain_blacklisted = You cannot register with your email address.
308309
authorize_application = Authorize Application
309310
authorize_redirect_notice = You will be redirected to %s if you authorize this application.
@@ -312,7 +313,6 @@ authorize_application_description = If you grant the access, it will be able to
312313
authorize_title = Authorize "%s" to access your account?
313314
authorization_failed = Authorization failed
314315
authorization_failed_desc = The authorization failed because we detected an invalid request. Please contact the maintainer of the app you've tried to authorize.
315-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
316316
sspi_auth_failed = SSPI authentication failed
317317
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.
318318
password_pwned_err = Could not complete request to HaveIBeenPwned

routers/web/user/auth.go

+1
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,7 @@ func ForgotPasswd(ctx *context.Context) {
14781478
ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title")
14791479

14801480
if setting.MailService == nil {
1481+
log.Warn(ctx.Tr("auth.disable_forgot_password_mail_admin"))
14811482
ctx.Data["IsResetDisable"] = true
14821483
ctx.HTML(http.StatusOK, tplForgotPassword)
14831484
return

templates/user/auth/forgot_passwd.tmpl

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
<button class="ui blue button">{{.i18n.Tr "auth.send_reset_mail"}}</button>
2323
</div>
2424
{{else if .IsResetDisable}}
25-
<p class="center">{{.i18n.Tr "auth.disable_forgot_password_mail"}}</p>
25+
<p class="center">
26+
{{if $.IsAdmin}}
27+
{{.i18n.Tr "auth.disable_forgot_password_mail_admin"}}
28+
{{else}}
29+
{{.i18n.Tr "auth.disable_forgot_password_mail"}}
30+
{{end}}
31+
</p>
2632
{{else if .ResendLimited}}
2733
<p class="center">{{.i18n.Tr "auth.resent_limit_prompt"}}</p>
2834
{{end}}

0 commit comments

Comments
 (0)