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

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

  {% if wizard.steps.current == 'auth' %}
    <p class="subtitle">{% blocktrans %}Enter your credentials.{% endblocktrans %}</p>
  {% elif wizard.steps.current == 'token' %}
    {% if device.method == 'call' %}
      <p class="subtitle">{% blocktrans trimmed %}We are calling your phone right now, please enter the
        digits you hear.{% endblocktrans %}</p>
    {% elif device.method == 'sms' %}
      <p class="subtitle">{% blocktrans trimmed %}We sent you a text message, please enter the tokens we
        sent.{% endblocktrans %}</p>
    {% else %}
      <p class="subtitle">{% blocktrans trimmed %}Please enter the tokens generated by your token
        generator.{% endblocktrans %}</p>
    {% endif %}
  {% elif wizard.steps.current == 'backup' %}
    <p class="subtitle">{% 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">{% csrf_token %}
    {% include "two_factor/_wizard_forms.html" %}

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

    {% if other_devices %}
      <p class="subtitle">{% trans "Or, alternatively, use one of your backup phones:" %}</p>
      <p class="subtitle">
        {% for other in other_devices %}
          <button name="challenge_device" value="{{ other.persistent_id }}"
                  class="button" type="submit">
            {{ other.generate_challenge_button_title }}
          </button>
        {% endfor %}</p>
    {% endif %}
    {% if backup_tokens %}
      <p class="subtitle">{% trans "As a last resort, you can use a backup token:" %}</p>
      <p class="subtitle">
        <button name="wizard_goto_step" type="submit" value="backup"
                class="button">{% trans "Use Backup Token" %}</button>
      </p>
    {% endif %}

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