misaki/tmpl/security.html
q 4512570a49
All checks were successful
Build & push Docker image / build (push) Successful in 2m22s
new features and style changes
2026-11-07 12:03:59 -05:00

27 lines
1.3 KiB
HTML

{{template "base.html" .}}
{{define "title"}}Two-factor login{{end}}
{{define "content"}}
{{if eq .Mode "setup"}}
<h1>Turn on 2FA</h1>
{{if .Error}}<p class="err">{{.Error}}</p>{{end}}
<p>Scan this with an authenticator app (Aegis, 2FAS, KeePassXC, any TOTP app). On a phone, <a href="{{.Link}}">tap here</a> to open it in the app.</p>
{{.QR}}
<p class="muted">Or type the key in:</p>
<p><code style="font-size:1.1em;letter-spacing:.05em">{{.Secret}}</code></p>
<p class="muted">Type it in as a time-based key, SHA1, 6 digits, 30 seconds (the defaults).</p>
<form method="POST" action="/dashboard/2fa/enable">
<input type="hidden" name="blob" value="{{.Blob}}">
<label for="code">Then enter the code it shows</label>
<input type="text" id="code" name="code" required autofocus autocomplete="one-time-code" inputmode="numeric" maxlength="8">
<input type="submit" value="Turn on">
</form>
<p style="margin-top:1.5rem;font-size:.9rem"><a href="/dashboard">Cancel</a></p>
{{else}}
<h1>2FA is on</h1>
<p class="ok">Save these recovery codes somewhere safe. Each one works once if you lose your phone. They won't be shown again.</p>
<pre style="font-size:1.1em;line-height:1.6">{{range .Codes}}{{.}}
{{end}}</pre>
<p>Your other sessions were logged out.</p>
<p><a href="/dashboard">Done, I saved them</a></p>
{{end}}
{{end}}