{% extends "sentry/account/twofactor/configure.html" %}

{% load i18n %}
{% load sentry_helpers %}

{% block twofactor_info %}
  {{ block.super }}

  <input type=hidden name="key_handle_to_delete">

  {% with auth.get_registered_devices as devices %}
    {% if devices %}
      <h3>Registered Devices</h3>
      <ul class="registered-devices">
        {% for device in devices %}
          <li><strong>{{ device.name }}</strong>, added on {{ device.timestamp|date:"N j, Y, P e" }}
            {% if devices|length > 1 %}
            <form action="" method=post style="display: inline">
              {% csrf_token %}
              <input type=hidden name="key_handle" value="{{ device.key_handle }}">
              <button type="submit" onclick="return confirm('Are you sure you want to remove this key?');" name="remove"
                class="btn btn-danger btn-sm"><span class="icon-trash"></span></button>
            </form>
            {% endif %}
        {% endfor %}
      </ul>
    {% endif %}
  {% endwith %}
{% endblock %}
{% block twofactor_buttons %}
  {{ block.super }}
  {% if auth.is_enrolled %}
    <button type="submit" name="enroll" class="btn btn-default">{% trans "Add Another Device" %}</button>
  {% endif %}
{% endblock %}
