Display friendly message on /reset if email is disabled

This commit is contained in:
Matt Baer 2023-10-03 11:15:33 -04:00
parent f404f7b928
commit c18987705c
2 changed files with 26 additions and 18 deletions

View File

@ -1279,6 +1279,7 @@ func viewResetPassword(app *App, w http.ResponseWriter, r *http.Request) error {
d := struct {
page.StaticPage
Flashes []string
EmailEnabled bool
CSRFField template.HTML
Token string
IsResetting bool
@ -1286,6 +1287,7 @@ func viewResetPassword(app *App, w http.ResponseWriter, r *http.Request) error {
}{
StaticPage: pageForReq(app, r),
Flashes: f,
EmailEnabled: app.cfg.Email.Enabled(),
CSRFField: csrf.TemplateField(r),
Token: token,
IsResetting: resetting,

View File

@ -14,6 +14,11 @@ label {
<div class="toosmall content-container clean">
<h1>Reset your password</h1>
{{ if not .EmailEnabled }}
<div class="alert info">
<p><strong>Email is not configured on this server!</strong> Please <a href="/contact">contact your admin</a> to reset your password.</p>
</div>
{{ else }}
{{if .Flashes}}<ul class="errors">
{{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
</ul>{{end}}
@ -46,3 +51,4 @@ function disableSubmit() {
}
</script>
{{ end }}
{{end}}