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:
@@ -0,0 +1,29 @@
|
||||
{{define "content"}}{{template "settings-start" .}}{{with .Data}}
|
||||
<h2>Two-factor sign-in</h2>
|
||||
{{if .Codes}}
|
||||
<section class="card">
|
||||
<h2>Your recovery codes</h2>
|
||||
<p>If you lose your phone, each of these signs you in once instead of a code. <strong>Save them now</strong> (in a password manager, or printed): they aren't shown again.</p>
|
||||
<pre id="codes">{{range .Codes}}{{.}}
|
||||
{{end}}</pre>
|
||||
<button type="button" class="secondary" data-copy="codes">Copy</button>
|
||||
<p><a class="button" href="/settings/account#two-factor">Done</a></p>
|
||||
</section>
|
||||
{{else}}
|
||||
<section class="card">
|
||||
<ol>
|
||||
<li>Open your authenticator app and add an account, by scanning this code:
|
||||
{{with .QR}}<p><img src="{{.}}" alt="QR code to add Supermarket to an authenticator app" width="246" height="246" class="qr"></p>{{end}}
|
||||
<p class="help">Or type this key: <code>{{.Secret}}</code> (time-based).</p></li>
|
||||
<li>Enter the six-digit code the app shows:
|
||||
<form method="post" action="/settings/account/two-factor">
|
||||
{{with .Problem}}<p class="error" role="alert">{{.}}</p>{{end}}
|
||||
<label>Code <input name="code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9 ]{6,7}" required autofocus></label>
|
||||
<button type="submit">Turn on two-factor sign-in</button>
|
||||
</form>
|
||||
</li>
|
||||
</ol>
|
||||
<p class="help">Then you get ten recovery codes, for when you don't have your phone. <a href="/settings/account">Cancel</a></p>
|
||||
</section>
|
||||
{{end}}
|
||||
{{end}}{{template "settings-end"}}{{end}}
|
||||
Reference in New Issue
Block a user