{% extends "two_factor/_base_focus.html" %}
{% load i18n %}
{% load two_factor_tags %}

{% block extra_media %}
  {{ form.media }}
{% endblock %}

{% block content %}
  <h1>{% block title %}{% trans "Login" %}{% endblock %}</h1>

  {% if wizard.steps.current == 'auth' %}
    <p>{% blocktrans %}Enter your credentials.{% endblocktrans %}</p>
  {% elif wizard.steps.current == 'token' %}
    <p>{{ device|as_verbose_action }}</p>
  {% elif wizard.steps.current == 'backup' %}
    <p>{% blocktrans trimmed %}Use this form for entering backup tokens for logging in.
      These tokens have been generated for you to print and keep safe. Please
      enter one of these backup tokens to login to your account.{% endblocktrans %}</p>
  {% endif %}

  <form action="" method="post">
    {% block main_form_content %}
    {% csrf_token %}
    {% include "two_factor/_wizard_forms.html" %}

    {# hidden submit button to enable [enter] key #}
    <input type="submit" value="" hidden />

    {% if other_devices %}
      <p>{% trans "Or, alternatively, use one of your other authentication methods:" %}</p>
      <p>
        {% for other in other_devices %}
        <button name="challenge_device" value="{{ other.persistent_id }}"
                class="btn btn-secondary btn-block" type="submit">
          {{ other|as_action }}
        </button>
      {% endfor %}</p>
    {% endif %}

    {% include "two_factor/_wizard_actions.html" %}
    {% endblock %}
  </form>

  {% block 'backup_tokens' %}
    {% if backup_tokens %}
       <hr>
       <div class="backup_tokens_form">
       <form action="" method="post">
           {% csrf_token %}
            <p>{% trans "As a last resort, you can use a backup token:" %}</p>
            <p>
                <button name="wizard_goto_step" type="submit" value="backup"
                    class="btn btn-sm btn-secondary btn-block">{% trans "Use Backup Token" %}</button>
            </p>
       </form>
       </div>
    {% endif %}
  {% endblock %}
{% endblock %}
