datatracker/ietf/templates/ietfauth/apikeys.html
Lars Eggert 276dd08794
fix: Don't offer already-disabled API keys for disablement (#5262)
* fix: Don't offer already-disabled API keys for disablement

Fixes #3441

* Remove test class
2023-03-02 10:18:51 -06:00

66 lines
2.3 KiB
HTML

{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load widget_tweaks django_bootstrap5 %}
{% load person_filters static %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}API keys for {{ user }}{% endblock %}
{% block content %}
{% origin %}
<h1>
API keys
<br>
<small class="text-muted">{{ user.username }}</small>
</h1>
{% csrf_token %}
{% if person.apikeys.all %}
<table class="table table-sm tablesorter">
<thead>
<tr >
<th scope="col" data-sort="endpoint">Endpoint</th>
<th scope="col" data-sort="created">Created</th>
<th scope="col" data-sort="date">Last use</th>
<th scope="col" data-sort="count">Count</th>
<th scope="col" data-sort="valid">Valid</th>
<th scope="col" data-sort="key">Key hash</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for key in person.apikeys.all %}
<tr>
<td>
<code>{{ key.endpoint }}</code>
</td>
<td>{{ key.created }}</td>
<td>{{ key.latest }}</td>
<td>{{ key.count }}</td>
<td class="{{ key.valid|yesno:'text-success,text-danger'}}">{{ key.valid }}</td>
<td>
<code {% if not key.valid %}class="text-decoration-line-through"{% endif %}>{{ key.hash }}</code>
</td>
<td >
{% if key.valid %}
<a href="{% url 'ietf.ietfauth.views.apikey_disable' %}?hash={{ key.hash }}"
class="btn btn-danger btn-sm del-apikey float-end">
Disable
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>You have no personal API keys.</p>
{% endif %}
<a href="{% url 'ietf.ietfauth.views.apikey_create' %}"
class="btn btn-primary add-apikey my-3">
Get a new personal API key
</a>
{% endblock %}
{% block js %}
<script src="{% static "ietf/js/list.js" %}"></script>
{% endblock %}