| 1 |
{% extends "mfa/base_entrance.html" %} |
| 2 |
{% load i18n %} |
| 3 |
{% load allauth %} |
| 4 |
{% load allauth static %} |
| 5 |
{% block head_title %} |
| 6 |
{% trans "Sign In" %} |
| 7 |
{% endblock head_title %} |
| 8 |
{% block content %} |
| 9 |
{% element h1 %} |
| 10 |
{% trans "Two-Factor Authentication" %} |
| 11 |
{% endelement %} |
| 12 |
{% element p %} |
| 13 |
{% blocktranslate %}Your account is protected by two-factor authentication. Please enter an authenticator code:{% endblocktranslate %} |
| 14 |
{% endelement %} |
| 15 |
{% url 'mfa_authenticate' as action_url %} |
| 16 |
{% element form form=form method="post" action=action_url %} |
| 17 |
{% slot body %} |
| 18 |
{% csrf_token %} |
| 19 |
{% element fields form=form unlabeled=True %} |
| 20 |
{% endelement %} |
| 21 |
{% endslot %} |
| 22 |
{% slot actions %} |
| 23 |
{% element button type="submit" tags="primary,mfa,login" %} |
| 24 |
{% trans "Sign In" %} |
| 25 |
{% endelement %} |
| 26 |
{% if "webauthn" not in MFA_SUPPORTED_TYPES %} |
| 27 |
{% element button type="submit" form="logout-from-stage" tags="link,mfa,cancel" %} |
| 28 |
{% trans "Cancel" %} |
| 29 |
{% endelement %} |
| 30 |
{% endif %} |
| 31 |
{% endslot %} |
| 32 |
{% endelement %} |
| 33 |
{% if "webauthn" in MFA_SUPPORTED_TYPES %} |
| 34 |
{% element hr %} |
| 35 |
{% endelement %} |
| 36 |
{% element h2 %} |
| 37 |
{% translate "Alternative options" %} |
| 38 |
{% endelement %} |
| 39 |
{% element button_group vertical=True %} |
| 40 |
{% element button form="webauthn_form" id="mfa_webauthn_authenticate" type="button" tags="outline,primary" %} |
| 41 |
{% trans "Use a security key" %} |
| 42 |
{% endelement %} |
| 43 |
{% element button type="submit" form="logout-from-stage" tags="outline,primary,mfa,cancel" %} |
| 44 |
{% trans "Cancel" %} |
| 45 |
{% endelement %} |
| 46 |
{% endelement %} |
| 47 |
{% if "webauthn" in MFA_SUPPORTED_TYPES %} |
| 48 |
{% element form id="webauthn_form" form=webauthn_form method="post" action=action_url no_visible_fields=True %} |
| 49 |
{% slot body %} |
| 50 |
{% csrf_token %} |
| 51 |
{% element fields form=webauthn_form %} |
| 52 |
{% endelement %} |
| 53 |
{% endslot %} |
| 54 |
{% endelement %} |
| 55 |
{{ js_data|json_script:"js_data" }} |
| 56 |
{% include "mfa/webauthn/snippets/scripts.html" %} |
| 57 |
<script data-allauth-onload="allauth.webauthn.forms.authenticateForm" type="application/json">{ |
| 58 |
"ids": { |
| 59 |
"authenticate": "mfa_webauthn_authenticate", |
| 60 |
"credential": "{{ webauthn_form.credential.auto_id }}", |
| 61 |
"data": "js_data" |
| 62 |
} |
| 63 |
} |
| 64 |
</script> |
| 65 |
{% endif %} |
| 66 |
{% endif %} |
| 67 |
<form id="logout-from-stage" |
| 68 |
method="post" |
| 69 |
action="{% url 'account_logout' %}"> |
| 70 |
<input type="hidden" name="next" value="{% url 'account_login' %}"> |
| 71 |
{% csrf_token %} |
| 72 |
</form> |
| 73 |
{% endblock content %} |