|
| 1 | +{% extends "mfa/index.html" %} |
| 2 | +{% load i18n %} |
| 3 | +{% load allauth_ui %} |
| 4 | +{% block content %} |
| 5 | + {% trans "Two-Factor Authentication" as heading %} |
| 6 | + {% #container heading=heading %} |
| 7 | + {% if "totp" in MFA_SUPPORTED_TYPES %} |
| 8 | + <h2 class="mt-6 mb-3 text-lg">{% translate "Authenticator App" %}</h2> |
| 9 | + {% if authenticators.totp %} |
| 10 | + <p class="my-2"> |
| 11 | + {% translate "Authentication using an authenticator app is active." %} |
| 12 | + <div> |
| 13 | + <a href="{% url "mfa_activate_totp" %}" |
| 14 | + role="button" |
| 15 | + class="my-3 btn btn-warning">{% translate "Deactivate" %}</a> |
| 16 | + </div> |
| 17 | + </p> |
| 18 | + {% else %} |
| 19 | + <p class="my-2">{% translate "An authenticator app is not active." %}</p> |
| 20 | + <a href="{% url "mfa_activate_totp" %}" |
| 21 | + role="button" |
| 22 | + class="btn btn-neutral">{% translate "Activate" %}</a> |
| 23 | + {% endif %} |
| 24 | + {% endif %} |
| 25 | + {% if "webauthn" in MFA_SUPPORTED_TYPES %} |
| 26 | + <div class="divider divider-neutral"></div> |
| 27 | + <h2 class="mt-6 mb-3 text-lg">{% translate "Security Keys" %}</h2> |
| 28 | + {% if authenticators.webauthn|length %} |
| 29 | + <p class="my-2"> |
| 30 | + {% blocktranslate count count=authenticators.webauthn|length %}You have added {{ count }} security key.{% plural %}You have added {{ count }} security keys.{% endblocktranslate %} |
| 31 | + </p> |
| 32 | + <a href="{% url "mfa_list_webauthn" %}" |
| 33 | + role="button" |
| 34 | + class="btn btn-neutral">{% translate "Manage" %}</a> |
| 35 | + {% else %} |
| 36 | + <p class="my-2">{% translate "No security keys have been added." %}</p> |
| 37 | + <a href="{% url "mfa_add_webauthn" %}" |
| 38 | + role="button" |
| 39 | + class="btn btn-neutral">{% translate "Add" %}</a> |
| 40 | + {% endif %} |
| 41 | + {% endif %} |
| 42 | + {% if "recovery_codes" in MFA_SUPPORTED_TYPES %} |
| 43 | + <div class="divider divider-neutral"></div> |
| 44 | + {% with total_count=authenticators.recovery_codes.generate_codes|length unused_count=authenticators.recovery_codes.get_unused_codes|length %} |
| 45 | + <h2 class="mt-6 mb-3 text-lg">{% translate "Recovery Codes" %}</h2> |
| 46 | + <p> |
| 47 | + {% if authenticators.recovery_codes %} |
| 48 | + {% 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 %} |
| 49 | + {% else %} |
| 50 | + {% translate "No recovery codes set up." %} |
| 51 | + {% endif %} |
| 52 | + </p> |
| 53 | + {% if is_mfa_enabled %} |
| 54 | + <div class="flex flex-col justify-evenly my-3 md:flex-row gap-1"> |
| 55 | + {% if authenticators.recovery_codes %} |
| 56 | + {% if unused_count > 0 %} |
| 57 | + <a href="{% url "mfa_view_recovery_codes" %}" |
| 58 | + role="button" |
| 59 | + class="btn btn-neutral">{% translate "View" %}</a> |
| 60 | + <a href="{% url "mfa_download_recovery_codes" %}" |
| 61 | + role="button" |
| 62 | + class="btn btn-neutral">{% translate "Download" %}</a> |
| 63 | + {% endif %} |
| 64 | + {% endif %} |
| 65 | + <a href="{% url "mfa_generate_recovery_codes" %}" |
| 66 | + role="button" |
| 67 | + class="btn btn-neutral">{% translate "Generate" %}</a> |
| 68 | + </div> |
| 69 | + {% endif %} |
| 70 | + {% endwith %} |
| 71 | + {% endif %} |
| 72 | + {% /container %} |
| 73 | +{% endblock content %} |
0 commit comments