{% 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("Recovery Codes") }}</h1>
    {% if recovery_codes %}
      <ul>
        {% for rc in recovery_codes %}
          <li class="fs-div">{{ rc }}</li>
        {% endfor %}
      </ul>
      <div class="fs-important">
      {{ _fsdomain("Be sure to copy these and store in a safe place. Each code can be used only once.") }}
      </div>
    {% else %}
      <form action="{{ url_for_security("mf_recovery_codes") }}" method="GET"
            name="mf_recovery_codes_form">

          {{ render_field(mf_recovery_codes_form.show_codes) }}
      </form>
    {% endif %}
    <hr class="fs-gap">
    <h2>Generate new Recovery Codes</h2>
    <form action="{{ url_for_security("mf_recovery_codes") }}" method="POST"
      name="mf_recovery_codes_form">
        {{ mf_recovery_codes_form.hidden_tag() }}
        {{ render_field_errors(mf_recovery_codes_form.csrf_token) }}
        {{ render_field(mf_recovery_codes_form.generate_new_codes) }}
    </form>
    {% include "security/_menu.html" %}
{% endblock %}
