This adds a self-serve password reset page. Users can enter their username and receive an email with a link that will let them create a new password. If they've never set a password, it will send them a one-time login link (building on #776) that will then take them to their Account Settings page. If they don't have an email associated with their account, they'll be instructed to contact the admin, so they can manually reset the password. Includes changes to the stylesheet and database, so run: make ui writefreely db migrate Closes T508
48 lines
1.2 KiB
Cheetah
48 lines
1.2 KiB
Cheetah
{{define "head"}}<title>Reset password — {{.SiteName}}</title>
|
|
<style>
|
|
input {
|
|
margin-bottom: 0.5em;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
label {
|
|
display: block;
|
|
}
|
|
</style>
|
|
{{end}}
|
|
{{define "content"}}
|
|
<div class="toosmall content-container clean">
|
|
<h1>Reset your password</h1>
|
|
|
|
{{if .Flashes}}<ul class="errors">
|
|
{{range .Flashes}}<li class="urgent">{{.}}</li>{{end}}
|
|
</ul>{{end}}
|
|
|
|
{{if .IsResetting}}
|
|
<form method="post" action="/reset" onsubmit="disableSubmit()">
|
|
<label>
|
|
<p>New Password</p>
|
|
<input type="password" name="new-pass" autocomplete="new-password" placeholder="New password" tabindex="1" />
|
|
</label>
|
|
<input type="hidden" name="t" value="{{.Token}}" />
|
|
<input type="submit" id="btn-login" value="Reset Password" />
|
|
{{ .CSRFField }}
|
|
</form>
|
|
{{else if not .IsSent}}
|
|
<form action="/reset" method="post" onsubmit="disableSubmit()">
|
|
<label>
|
|
<p>Username</p>
|
|
<input type="text" name="alias" placeholder="Username" autofocus />
|
|
</label>
|
|
{{ .CSRFField }}
|
|
<input type="submit" id="btn-login" value="Reset Password" />
|
|
</form>
|
|
{{end}}
|
|
|
|
<script type="text/javascript">
|
|
var $btn = document.getElementById("btn-login");
|
|
function disableSubmit() {
|
|
$btn.disabled = true;
|
|
}
|
|
</script>
|
|
{{end}}
|