{% set title = title|default(_fsdomain("Two-Factor Authentication")) %}
{% extends "security/base.html" %}
{% from "security/_macros.html" import render_field_with_errors, render_field, prop_next, render_csrf %}

{% block content %}
  {% include "security/_messages.html" %}
  <h1>{{ _fsdomain("Two-Factor Authentication") }}</h1>
  <h3>{{ _fsdomain("Please enter your authentication code generated via: %(method)s", method=chosen_method) }}</h3> {# chosen_method is translated string #}
  <form action="{{ url_for_security('two_factor_token_validation') }}{{ prop_next() }}" method="post" name="two_factor_verify_code_form">
    {{ two_factor_verify_code_form.hidden_tag() }}
    {{ render_field_with_errors(two_factor_verify_code_form.code, placeholder=_fsdomain("enter numeric code")) }}
    {{ render_field(two_factor_verify_code_form.submit) }}
  </form>
  {% if two_factor_rescue_form %}
    <hr class="fs-gap">
    <form action="{{ url_for_security('two_factor_rescue') }}{{ prop_next() }}" method="post" name="two_factor_rescue_form">
      {# explicitly render csrf_token so we can change the ID so we don't get duplicates #}
      {{ render_csrf(two_factor_rescue_form, "rescue") }}
      {{ render_field_with_errors(two_factor_rescue_form.help_setup) }}
      {% if problem=="email" %}
        <div>{{ _fsdomain("The code for authentication was sent to your email address") }}</div>
      {% endif %}
      {% if problem=="help" %}
        <div>{{ _fsdomain("An email was sent to us in order to reset your application account") }}</div>
      {% endif %}
      {{ render_field(two_factor_rescue_form.submit) }}
    </form>
  {% endif %}
  {% include "security/_menu.html" %}
{% endblock content %}
