{% extends "mfa/recovery_codes/base.html" %}
{% load i18n allauth static %}
{% comment %}
Overrides django-allauth's mfa/recovery_codes/index.html to add Back button.
NOTE: When upgrading django-allauth, check this template in django-allauth for
changes. If the django-allauth version of this templates has updates, this template
should be replaced with theirs with the addition of our changes (clearly marked below).
{% endcomment %}
{% block content %}
{% element h1 %}
{% translate "Recovery Codes" %}
{% endelement %}
{% element p %}
{% blocktranslate count unused_count=unused_codes|length %}There is {{ unused_count }} out of {{ total_count }} recovery codes available.{% plural %}There are {{ unused_count }} out of {{ total_count }} recovery codes available.{% endblocktranslate %}
{% endelement %}
{% if can_view_codes %}
{% element field id="recovery_codes" type="textarea" rows=unused_codes|length readonly=True %}
{% slot label %}
{% translate "Unused codes" %}
{% endslot %}
{# djlint:off #}
{% slot value %}{% for code in unused_codes %}{% if forloop.counter0 %}
{% endif %}{{ code }}{% endfor %}{% endslot %}
{# djlint:on #}
{% endelement %}
{% endif %}
{% if can_download_codes %}
{% url 'mfa_download_recovery_codes' as download_url %}
{% element button href=download_url %}
{% translate "Download codes" %}
{% endelement %}
{% endif %}
{% if can_generate_codes %}
{% url 'mfa_generate_recovery_codes' as generate_url %}
{% element button href=generate_url %}
{% translate "Generate new codes" %}
{% endelement %}
{% endif %}
{% if MFA_RECOVERY_CODES_SHOW_ONCE and can_view_codes %}
{% element field type="checkbox" id="codes_saved" %}
{% slot label %}
{% translate "I have saved my recovery codes" %}
{% endslot %}
{% endelement %}
{% endif %}
{# --- TOM Toolkit addition: begin --- #}
{% url 'mfa_index' as back_url %}
{% element button href=back_url id="back_button" tags="secondary" %}
{% translate "Back to Two-Factor Authentication" %}
{% endelement %}
{# --- TOM Toolkit addition: end --- #}
{% endblock content %}
{% block extra_body %}
{{ block.super }}
{% endblock extra_body %}