{% extends "flask_deck/base.html" %} {% block breadcrumbs %} / {{ _("2FA Security") }} {% endblock %} {% block content %}

Two-Factor Authentication (TOTP)

Zero-dependency RFC 6238 authenticator protection with replay defense & single-use recovery codes.

{% if demo_safe_mode %} {{ deck_icon("lock", 11) }} DEMO LOCKED {% endif %} {% if enrollment and enrollment.enabled %} MFA ACTIVE {% else %} NOT ENROLLED {% endif %}
{% set demo_lock_message = "Pure SSR SVG QR code and Base32 secret generation are live for inspection, while activating or disabling 2FA is locked so shared demo accounts remain accessible to everyone." %} {% include "flask_deck/partials/demo_lock_banner.html" %} {% if error_msg %} {% endif %} {% if recovery_once %}

Save Your One-Time Recovery Codes

Stored as PBKDF2 hashes — these plaintext codes will never be displayed again.

SHOWN ONCE
{% for rc in recovery_once %} {{ rc }} {% endfor %}
{% endif %} {% if enrollment and enrollment.enabled %}

Authenticator Enrolled

Account: {{ current_user.username }} · {{ enrollment.recovery_hashes | length }} unused recovery code(s) remaining

{% if mfa_required_for_user %}
{{ deck_icon("shield-check", 13) }} Superuser MFA enforcement policy is active; two-factor authentication cannot be disabled on this account.
{% else %}
{% if demo_safe_mode %} {% else %} {% endif %}
{% endif %}
{% else %}

1. Scan QR Code

Pure SSR SVG
{{ qr_svg }}
{{ setup_secret }}

2. Confirm Authenticator Code

Scan the QR code with 1Password, Apple Passwords, Authy, or Google Authenticator, then enter the generated 6-digit code to activate MFA.

{% endif %}
{% endblock %}