{% extends "security/base.html" %}
{% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors %}

{% block content %}
    {% include "security/_messages.html" %}
    <h1>{{ _fsdomain("Please Reauthenticate") }}</h1>
      <form action="{{ url_for_security("us_verify") }}{% if 'next' in request.args %}?next={{ request.args.next|urlencode }}{% endif %}" method="POST"
          name="us_verify_form">
      {{ us_verify_form.hidden_tag() }}
      {{ render_field_with_errors(us_verify_form.passcode) }}
      {{ render_field(us_verify_form.submit) }}
      {% if code_methods %}
        <h4>{{ _fsdomain("Request one-time code be sent") }}</h4>
        {% for subfield in us_verify_form.chosen_method %}
          {% if subfield.data in code_methods %}
            {{ render_field_with_errors(subfield) }}
          {% endif %}
        {% endfor %}
        {{ render_field_errors(us_verify_form.chosen_method) }}
        {% if code_sent %}
          <p>{{ _fsdomain("Code has been sent") }}
        {% endif %}
        <div class="fs-gap">{{ render_field(us_verify_form.submit_send_code, formaction=send_code_to) }}</div>
      {% endif %}
      </form>
      {% if has_webauthn_verify_credential %}
        <hr class="fs-gap">
        <h2>{{ _fsdomain("Use a WebAuthn Security Key to Reauthenticate") }}</h2>
        <form action="{{ url_for_security("wan_verify") }}{% if 'next' in request.args %}?next={{ request.args.next|urlencode }}{% endif %}" method="POST"
          name="wan_verify_form">
            {{ wan_verify_form.hidden_tag() }}
            {{ render_field(wan_verify_form.submit) }}
        </form>
      {% endif %}
  {% include "security/_menu.html" %}
{% endblock %}
