{% extends "mfa/base_entrance.html" %} {% load allauth i18n lucide ui %} {% comment %} Overridden for layout: the code is a daisyUI otp field, Cancel sits beside Sign In, and "Use a security key" is an accent button under Alternative options. Cancel and the security key both submit *other* forms (`logout-from-stage`, `webauthn_form`) through the HTML `form` attribute — forms cannot nest, so those live at the end of the page and the buttons point at them by id. {% endcomment %} {% block head_title %} {% trans "Sign In" %} {% endblock head_title %} {% block content %} {% element h1 %} {% trans "Two-Factor Authentication" %} {% endelement %} {% element p %} {% blocktranslate %}Your account is protected by two-factor authentication. Please enter an authenticator code:{% endblocktranslate %} {% endelement %}
{% csrf_token %}
{% comment %} daisyUI's otp is one input overlaid on the boxes. Six of them, for a TOTP code — but this same field also accepts an 8-character recovery code, so the boxes step aside once what's typed no longer fits them (see the script below). Boxing it to six and calling it done would lock out recovery codes. {% endcomment %}
{{ form.code|daisy:"" }}
{% for error in form.code.errors %}{{ error }}{% endfor %} {% for error in form.non_field_errors %}{{ error }}{% endfor %}
{% if "webauthn" in MFA_SUPPORTED_TYPES %} {% element hr %} {% endelement %} {% element h2 %} {% translate "Alternative options" %} {% endelement %}
{% csrf_token %} {{ webauthn_form.credential }}
{{ js_data|json_script:"js_data" }} {% include "mfa/webauthn/snippets/scripts.html" %} {% endif %}
{% csrf_token %}
{% endblock content %}