| 1 |
<h2 class="subsection-title">Two-Factor Authentication</h2> |
| 2 |
|
| 3 |
{% if enabled %} |
| 4 |
<div class="totp-status-row"> |
| 5 |
<span class="badge active">Enabled</span> |
| 6 |
</div> |
| 7 |
|
| 8 |
<div class="totp-section"> |
| 9 |
<h3 class="mb-2">Regenerate Backup Codes</h3> |
| 10 |
<p class="muted mb-3 text-sm"> |
| 11 |
Generate new backup codes. This will invalidate your existing codes. |
| 12 |
</p> |
| 13 |
<form hx-post="/api/users/me/totp/backup-codes" |
| 14 |
hx-target="#backup-codes-container" |
| 15 |
hx-swap="innerHTML"> |
| 16 |
<div class="field-row"> |
| 17 |
<div class="form-group is-grow"> |
| 18 |
<input type="password" name="password" placeholder="Enter your password" required> |
| 19 |
</div> |
| 20 |
<button class="btn-secondary" type="submit">Regenerate</button> |
| 21 |
</div> |
| 22 |
<span id="backup-regen-status"></span> |
| 23 |
</form> |
| 24 |
<div id="backup-codes-container" class="totp-regen-output"></div> |
| 25 |
</div> |
| 26 |
|
| 27 |
<div> |
| 28 |
<h3 class="mb-2">Disable Two-Factor Authentication</h3> |
| 29 |
<p class="muted mb-3 text-sm"> |
| 30 |
Remove 2FA from your account. You will need to enter your password to confirm. |
| 31 |
</p> |
| 32 |
<form hx-post="/api/users/me/totp/disable" |
| 33 |
hx-target="#totp-section" |
| 34 |
hx-swap="innerHTML"> |
| 35 |
<div class="field-row"> |
| 36 |
<div class="form-group is-grow"> |
| 37 |
<input type="password" name="password" placeholder="Enter your password" required> |
| 38 |
</div> |
| 39 |
<button class="btn-danger" type="submit">Disable 2FA</button> |
| 40 |
</div> |
| 41 |
<span id="totp-disable-status"></span> |
| 42 |
</form> |
| 43 |
</div> |
| 44 |
|
| 45 |
{% else %} |
| 46 |
<p class="muted mb-4"> |
| 47 |
Add an extra layer of security to your account by requiring a verification code when you log in. |
| 48 |
</p> |
| 49 |
<button class="btn-primary" |
| 50 |
hx-post="/api/users/me/totp/setup" |
| 51 |
hx-target="#totp-section" |
| 52 |
hx-swap="innerHTML"> |
| 53 |
Enable Two-Factor Authentication |
| 54 |
</button> |
| 55 |
{% endif %} |
| 56 |
|