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

{% block content %}

  <div class="login-form">
  <h1>{% block title %}{% trans "Login" %}{% endblock %}</h1>

  {% if wizard.steps.current == 'auth' %}
    <p>{% blocktrans %}Enter your credentials.{% endblocktrans %}</p>
  {% elif wizard.steps.current == 'token' %}
    {% if device.method == 'call' %}
      <p>{% blocktrans %}We are calling your phone right now, please enter the
        digits you hear.{% endblocktrans %}</p>
    {% elif device.method == 'sms' %}
      <p>{% blocktrans %}We sent you a text message, please enter the tokens we
        sent.{% endblocktrans %}</p>
    {% elif device.method == "email" %}
      <p>{% blocktrans %}We sent you an email, please enter the one time password we sent.{% endblocktrans %}</p>
    {% else %}
      <p>{% blocktrans %}Please enter the tokens generated by your token
        generator.{% endblocktrans %}</p>
    {% endif %}
  {% elif wizard.steps.current == 'security-key' %}
      <p>
        <div data-2fa-method="{{ device.method }}" data-username="{{ device.user.username }}">{% trans "Requesting U2F security key authentication" %}</div>
      </p>
  {% elif wizard.steps.current == 'backup' %}
    <p>{% blocktrans %}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">{% csrf_token %}
    {% include "two_factor/_wizard_forms.html" %}

    {# hidden submit button to enable [enter] key #}
    <div style="margin-left: -9999px"><input type="submit" value=""/></div>

    {% if other_devices %}
      <p>{% trans "Or, alternatively, you can request a one time password via one of your recovery options:" %}</p>
      <p>
        {% for other in other_devices %}
        <button name="challenge_device" data-device-step="{{ other.method }}" value="{{ other.persistent_id }}"
                class="btn btn-default btn-block" type="submit">
          {{ other|device_action }}
        </button>
      {% endfor %}</p>
    {% endif %}
    {% if backup_tokens %}
      <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-default btn-block">{% trans "Use Backup Token" %}</button>
      </p>
    {% endif %}

    <div class="marg-top-30">
    {% include "two_factor/_wizard_actions.html" %}
    </div>

  </form>
  </div>
{% endblock %}
