| 1 | {{ define "page" -}} |
| 2 | <div class="shithub-settings-page"> |
| 3 | {{ template "settings-nav" . }} |
| 4 | <div class="shithub-settings-content"> |
| 5 | {{ if .RecoveryCodes }} |
| 6 | <h1>Save your recovery codes</h1> |
| 7 | <section class="shithub-settings-section"> |
| 8 | <p>These codes are shown <strong>once</strong>. Each works one time, in place of your authenticator code, if you lose access to your device. Store them in a password manager or print them.</p> |
| 9 | <ul class="shithub-recovery-codes" aria-label="Recovery codes"> |
| 10 | {{ range .RecoveryCodes }}<li><code>{{ . }}</code></li>{{ end }} |
| 11 | </ul> |
| 12 | <p><a href="/settings/security/2fa/disable" class="shithub-button">Done — return to security settings</a></p> |
| 13 | </section> |
| 14 | {{ else }} |
| 15 | <h1>Two-factor authentication</h1> |
| 16 | <section class="shithub-settings-section"> |
| 17 | {{ with .Error }}<p class="shithub-flash shithub-flash-error" role="alert">{{ . }}</p>{{ end }} |
| 18 | <p>Enter the 6-digit code from your authenticator app to finish enabling 2FA.</p> |
| 19 | <form method="POST" action="/settings/security/2fa/enable" novalidate> |
| 20 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 21 | <label> |
| 22 | <span>Code</span> |
| 23 | <input type="text" name="code" required inputmode="numeric" |
| 24 | pattern="[0-9]{6}" minlength="6" maxlength="6"> |
| 25 | </label> |
| 26 | <button type="submit" class="shithub-button shithub-button-primary">Confirm</button> |
| 27 | </form> |
| 28 | </section> |
| 29 | {{ end }} |
| 30 | </div> |
| 31 | </div> |
| 32 | {{- end }} |