{% extends "kagi/base.html" %}
{% load i18n %}
{% load static %}

{% block content %}
{{ block.super }}
<h1>WebAuthn Keys</h1>
<a href="{% url 'kagi:two-factor-settings' %}">{% trans '&larr; Back to settings' %}</a>
<table>
  <thead>
    <tr>
      <th>{% trans 'Key name' %}</th>
      <th>{% trans 'Added on' %}</th>
      <th>{% trans 'Last used on' %}</th>
    </tr>
  </thead>
  <tbody>
    {% for key in object_list %}
    <tr>
      <td>{{ key.key_name }}</td>
      <td>{{ key.created_at }}</td>
      {% trans 'Never' as never %}
      <td>{{ key.last_used_at|default:never }}</td>
      <td>
        <form method="post">{% csrf_token %}
          <input name="key_id" type="hidden" value="{{ key.pk }}">
          <input type="submit" name="delete" value="X">
        </form>
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
<div id="webauthn-feature">
  <a href="{% url 'kagi:add-webauthn-key' %}">{% trans 'Add another key' %}</a>
</div>

<script src="{% static 'kagi/webauthn.js' %}"></script>
{% endblock %}
