| 1 |
{% extends "mfa/base_manage.html" %} |
| 2 |
{% load allauth %} |
| 3 |
{% load i18n %} |
| 4 |
{% block head_title %} |
| 5 |
{% trans "Two-Factor Authentication" %} |
| 6 |
{% endblock head_title %} |
| 7 |
{% block content %} |
| 8 |
{% element h1 tags="mfa,index" %} |
| 9 |
{% trans "Two-Factor Authentication" %} |
| 10 |
{% endelement %} |
| 11 |
{% if "totp" in MFA_SUPPORTED_TYPES %} |
| 12 |
{% element panel %} |
| 13 |
{% slot title %} |
| 14 |
{% translate "Authenticator App" %} |
| 15 |
{% endslot %} |
| 16 |
{% slot body %} |
| 17 |
{% if authenticators.totp %} |
| 18 |
{% element p %} |
| 19 |
{% translate "Authentication using an authenticator app is active." %} |
| 20 |
{% endelement %} |
| 21 |
{% else %} |
| 22 |
{% element p %} |
| 23 |
{% translate "An authenticator app is not active." %} |
| 24 |
{% endelement %} |
| 25 |
{% endif %} |
| 26 |
{% endslot %} |
| 27 |
{% slot actions %} |
| 28 |
{% url 'mfa_deactivate_totp' as deactivate_url %} |
| 29 |
{% url 'mfa_activate_totp' as activate_url %} |
| 30 |
{% if authenticators.totp %} |
| 31 |
{% element button href=deactivate_url tags="danger,delete,panel" %} |
| 32 |
{% translate "Deactivate" %} |
| 33 |
{% endelement %} |
| 34 |
{% else %} |
| 35 |
{% element button href=activate_url tags="panel" %} |
| 36 |
{% translate "Activate" %} |
| 37 |
{% endelement %} |
| 38 |
{% endif %} |
| 39 |
{% endslot %} |
| 40 |
{% endelement %} |
| 41 |
{% endif %} |
| 42 |
{% if "webauthn" in MFA_SUPPORTED_TYPES %} |
| 43 |
{% element panel %} |
| 44 |
{% slot title %} |
| 45 |
{% translate "Security Keys" %} |
| 46 |
{% endslot %} |
| 47 |
{% slot body %} |
| 48 |
{% if authenticators.webauthn|length %} |
| 49 |
{% element p %} |
| 50 |
{% blocktranslate count count=authenticators.webauthn|length %}You have added {{ count }} security key.{% plural %}You have added {{ count }} security keys.{% endblocktranslate %} |
| 51 |
{% endelement %} |
| 52 |
{% else %} |
| 53 |
{% element p %} |
| 54 |
{% translate "No security keys have been added." %} |
| 55 |
{% endelement %} |
| 56 |
{% endif %} |
| 57 |
{% endslot %} |
| 58 |
{% slot actions %} |
| 59 |
{% if authenticators.webauthn|length %} |
| 60 |
{% url 'mfa_list_webauthn' as webauthn_list_url %} |
| 61 |
{% element button href=webauthn_list_url %} |
| 62 |
{% translate "Manage" %} |
| 63 |
{% endelement %} |
| 64 |
{% else %} |
| 65 |
{% url 'mfa_add_webauthn' as webauthn_add_url %} |
| 66 |
{% element button href=webauthn_add_url %} |
| 67 |
{% translate "Add" %} |
| 68 |
{% endelement %} |
| 69 |
{% endif %} |
| 70 |
{% endslot %} |
| 71 |
{% endelement %} |
| 72 |
{% endif %} |
| 73 |
{% if "recovery_codes" in MFA_SUPPORTED_TYPES %} |
| 74 |
{% with total_count=authenticators.recovery_codes.generate_codes|length unused_count=authenticators.recovery_codes.get_unused_codes|length %} |
| 75 |
{% element panel %} |
| 76 |
{% slot title %} |
| 77 |
{% translate "Recovery Codes" %} |
| 78 |
{% endslot %} |
| 79 |
{% slot body %} |
| 80 |
{% if authenticators.recovery_codes %} |
| 81 |
{% element p %} |
| 82 |
{% blocktranslate count unused_count=unused_count %}There is {{ unused_count }} out of {{ total_count }} recovery codes available.{% plural %}There are {{ unused_count }} out of {{ total_count }} recovery codes available.{% endblocktranslate %} |
| 83 |
{% endelement %} |
| 84 |
{% else %} |
| 85 |
{% element p %} |
| 86 |
{% translate "No recovery codes set up." %} |
| 87 |
{% endelement %} |
| 88 |
{% endif %} |
| 89 |
{% endslot %} |
| 90 |
{% if is_mfa_enabled %} |
| 91 |
{% if authenticators.recovery_codes %} |
| 92 |
{% if unused_count > 0 and not MFA_RECOVERY_CODES_SHOW_ONCE %} |
| 93 |
{% slot actions %} |
| 94 |
{% url 'mfa_view_recovery_codes' as view_url %} |
| 95 |
{% element button href=view_url tags="panel" %} |
| 96 |
{% translate "View" %} |
| 97 |
{% endelement %} |
| 98 |
{% endslot %} |
| 99 |
{% slot actions %} |
| 100 |
{% url 'mfa_download_recovery_codes' as download_url %} |
| 101 |
{% element button href=download_url tags="secondary,panel" %} |
| 102 |
{% translate "Download" %} |
| 103 |
{% endelement %} |
| 104 |
{% endslot %} |
| 105 |
{% endif %} |
| 106 |
{% endif %} |
| 107 |
{% slot actions %} |
| 108 |
{% url 'mfa_generate_recovery_codes' as generate_url %} |
| 109 |
{% element button href=generate_url tags="secondary,panel" %} |
| 110 |
{% translate "Generate" %} |
| 111 |
{% endelement %} |
| 112 |
{% endslot %} |
| 113 |
{% endif %} |
| 114 |
{% endelement %} |
| 115 |
{% endwith %} |
| 116 |
{% endif %} |
| 117 |
{% endblock content %} |