Display friendly message on /reset if email is disabled

pull/777/head
Matt Baer 1 year ago
parent f404f7b928
commit c18987705c
  1. 2
      account.go
  2. 16
      pages/reset.tmpl

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

@ -14,6 +14,11 @@ label {
<div class="toosmall content-container clean"> <div class="toosmall content-container clean">
<h1>Reset your password</h1> <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"> {{if .Flashes}}<ul class="errors">
{{range .Flashes}}<li class="urgent">{{.}}</li>{{end}} {{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
</ul>{{end}} </ul>{{end}}
@ -39,10 +44,11 @@ label {
</form> </form>
{{end}} {{end}}
<script type="text/javascript"> <script type="text/javascript">
var $btn = document.getElementById("btn-login"); var $btn = document.getElementById("btn-login");
function disableSubmit() { function disableSubmit() {
$btn.disabled = true; $btn.disabled = true;
} }
</script> </script>
{{ end }}
{{end}} {{end}}

Loading…
Cancel
Save