mirror of
https://github.com/writeas/writefreely
synced 2025-02-02 23:37:32 +01:00
Display friendly message on /reset if email is disabled
This commit is contained in:
parent
f404f7b928
commit
c18987705c
24
account.go
24
account.go
@ -1278,18 +1278,20 @@ func viewResetPassword(app *App, w http.ResponseWriter, r *http.Request) error {
|
||||
// Show reset password page
|
||||
d := struct {
|
||||
page.StaticPage
|
||||
Flashes []string
|
||||
CSRFField template.HTML
|
||||
Token string
|
||||
IsResetting bool
|
||||
IsSent bool
|
||||
Flashes []string
|
||||
EmailEnabled bool
|
||||
CSRFField template.HTML
|
||||
Token string
|
||||
IsResetting bool
|
||||
IsSent bool
|
||||
}{
|
||||
StaticPage: pageForReq(app, r),
|
||||
Flashes: f,
|
||||
CSRFField: csrf.TemplateField(r),
|
||||
Token: token,
|
||||
IsResetting: resetting,
|
||||
IsSent: r.FormValue("sent") == "1",
|
||||
StaticPage: pageForReq(app, r),
|
||||
Flashes: f,
|
||||
EmailEnabled: app.cfg.Email.Enabled(),
|
||||
CSRFField: csrf.TemplateField(r),
|
||||
Token: token,
|
||||
IsResetting: resetting,
|
||||
IsSent: r.FormValue("sent") == "1",
|
||||
}
|
||||
err := pages["reset.tmpl"].ExecuteTemplate(w, "base", d)
|
||||
if err != nil {
|
||||
|
@ -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}}
|
||||
@ -26,7 +31,7 @@ label {
|
||||
</label>
|
||||
<input type="hidden" name="t" value="{{.Token}}" />
|
||||
<input type="submit" id="btn-login" value="Reset Password" />
|
||||
{{ .CSRFField }}
|
||||
{{ .CSRFField }}
|
||||
</form>
|
||||
{{else if not .IsSent}}
|
||||
<form action="/reset" method="post" onsubmit="disableSubmit()">
|
||||
@ -39,10 +44,11 @@ label {
|
||||
</form>
|
||||
{{end}}
|
||||
|
||||
<script type="text/javascript">
|
||||
var $btn = document.getElementById("btn-login");
|
||||
function disableSubmit() {
|
||||
$btn.disabled = true;
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var $btn = document.getElementById("btn-login");
|
||||
function disableSubmit() {
|
||||
$btn.disabled = true;
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user