Phase 10, part 3: signing in and out, resets, locks and two-factor

The server edition now starts. Sign-in by email and password, limited per
address and per IP; ten failures in a row lock the account and email its
owner, and a reset by email (or an admin) unlocks it. Settings → Your
account has the profile, the password, where you're signed in, and
two-factor sign-in with an authenticator app (TOTP, from a QR code) and
ten recovery codes. The app's own mail goes through SUPERMARKET_MAIL_URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:01:29 -07:00
co-authored by Claude Opus 5.5
parent 72455438c9
commit 8040512a18
26 changed files with 1991 additions and 12 deletions
+29
View File
@@ -0,0 +1,29 @@
{{define "content"}}{{with .Data}}
{{if .Reset}}
<h1>Choose a new password</h1>
{{with .Problem}}<p class="error" role="alert">{{.}}</p>{{end}}
<form class="card" method="post" action="/reset/{{.Reset}}">
<label>New password <input type="password" name="password" autocomplete="new-password" minlength="10" required autofocus>
<span class="help">At least 10 characters. A few unrelated words make a good one.</span></label>
<label>The same password again <input type="password" name="password2" autocomplete="new-password" minlength="10" required></label>
<button type="submit">Save the new password</button>
</form>
<p class="help">Every place you're signed in is signed out; then you sign in with the new password.</p>
{{else if .Sent}}
<h1>Check your email</h1>
<section class="card">
<p>If there's an account for <strong>{{.Email}}</strong>, a link to choose a new password is on its way. It works once, for an hour.</p>
<p class="help">Nothing after a few minutes? Check the spam folder, and that the address is the one you sign in with.</p>
</section>
<p class="help"><a href="/signin">Back to signing in</a></p>
{{else}}
<h1>Reset your password</h1>
{{with .Problem}}<p class="error" role="alert">{{.}}</p>{{end}}
<form class="card" method="post" action="/forgot">
<label>Your email address <input type="email" name="email" value="{{.Email}}" autocomplete="username" required autofocus>
<span class="help">We'll email you a link to choose a new one. Resetting also unlocks a locked account.</span></label>
<button type="submit">Send the link</button>
</form>
<p class="help"><a href="/signin">Back to signing in</a></p>
{{end}}
{{end}}{{end}}