{% extends "maykin_2fa/base.html" %}
{% load i18n %}

{% block content %}
    <p>{% blocktrans trimmed %}
        Backup tokens can be used if you have lost access to your second factor
        device(s). The backup tokens below can be used for login verification. If
        you've used up all your backup tokens, you can generate a new set. Only the
        backup tokens shown below will be valid.
    {% endblocktrans %}</p>

    {% if device.token_set.all %}
        <ul class="backup-tokens-list">
            {% for token in device.token_set.all %}
                <li>
                    <code>{{ token.token }}</code>
                </li>
            {% endfor %}
        </ul>
        <p>
            {% blocktrans trimmed %}Print these tokens and keep them somewhere safe.{% endblocktrans %}
        </p>
        <p>{% blocktrans trimmed %}
            If you generate tokens again, they will replace the existing tokens.
        {% endblocktrans %}</p>
    {% else %}
        <p>{% trans "⚠️ You don't have any backup tokens yet." %}</p>
    {% endif %}

    <form method="post">
        {% csrf_token %}
        {{ form.as_p }}
        {% comment %}

        <a href="{% url 'two_factor:profile'%}" class="float-right btn btn-link">
            {% trans "Back to Account Security" %}
        </a>
        {% endcomment %}
        <div class="submit-row">
            <div class="actions-buttons">
                <button class="button button--padded" type="submit">
                    {% trans "Generate tokens" %}
                </button>
            </div>
        </div>

        <div class="m2fa-nav-links">
            <a href="{% url 'admin:index' %}">{% trans "Go to admin" %}</a>
            <a href="{% url 'maykin_2fa:account_security' %}">
                {% trans "Manage account security" %}
            </a>
        </div>

    </form>
{% endblock %}
