Skip to content

Commit c28a352

Browse files
committed
Add better errors for disabled account recovery
Signed-off-by: jolheiser <[email protected]>
1 parent 4c4a86b commit c28a352

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new
299299
openid_register_title = Create new account
300300
openid_register_desc = The chosen OpenID URI is unknown. Associate it with a new account here.
301301
openid_signin_desc = Enter your OpenID URI. For example: https://anne.me, bob.openid.org.cn or gnusocial.net/carry.
302-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
302+
disable_forgot_password_mail = Account recovery is disabled because no email is set up. Please contact your site administrator.
303+
disable_forgot_password_mail_admin = Account recovery is only available when email is set up. Please set up email to enable account recovery.
303304
email_domain_blacklisted = You cannot register with your email address.
304305
authorize_application = Authorize Application
305306
authorize_redirect_notice = You will be redirected to %s if you authorize this application.
@@ -308,7 +309,6 @@ authorize_application_description = If you grant the access, it will be able to
308309
authorize_title = Authorize "%s" to access your account?
309310
authorization_failed = Authorization failed
310311
authorization_failed_desc = The authorization failed because we detected an invalid request. Please contact the maintainer of the app you've tried to authorize.
311-
disable_forgot_password_mail = Account recovery is disabled. Please contact your site administrator.
312312
sspi_auth_failed = SSPI authentication failed
313313
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.
314314
password_pwned_err = Could not complete request to HaveIBeenPwned

routers/user/auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,7 @@ func ForgotPasswd(ctx *context.Context) {
13471347
ctx.Data["Title"] = ctx.Tr("auth.forgot_password_title")
13481348

13491349
if setting.MailService == nil {
1350+
log.Warn(ctx.Tr("auth.disable_forgot_password_mail_admin"))
13501351
ctx.Data["IsResetDisable"] = true
13511352
ctx.HTML(200, tplForgotPassword)
13521353
return

templates/user/auth/forgot_passwd.tmpl

Lines changed: 7 additions & 1 deletion
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)