Separate revoked API keys from still active ones
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
6a5acaab32
commit
06b0973d45
1 changed files with 31 additions and 2 deletions
|
|
@ -36,7 +36,7 @@ API Keys - {{ current_user.username }}
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for api_key in api_keys %}
|
||||
{% for api_key in api_keys | filter(attribute="revoked", value=false) %}
|
||||
<tr>
|
||||
<td class="border border-zinc-200 p-2">{{ api_key.name}}</td>
|
||||
<td class="border border-zinc-200 p-2 text-center">
|
||||
|
|
@ -60,8 +60,37 @@ API Keys - {{ current_user.username }}
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="border border-zinc-200 p-6 text-center">No active API Keys</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tbody>
|
||||
{% for api_key in api_keys | filter(attribute="revoked", value=true) %}
|
||||
<tr class="{% if loop.first %}border-t-zinc-400 border-t-4{% endif %}">
|
||||
<td class="border border-zinc-200 p-2">{{ api_key.name}}</td>
|
||||
<td class="border border-zinc-200 p-2 text-center">
|
||||
{% if api_key.revoked %}
|
||||
<span class="align-middle">No Longer Active</span><span class="inline-block align-middle size-6 ml-2 bg-zinc-500 rounded-lg"></span>
|
||||
{% else %}
|
||||
<span class="align-middle">Currently Active</span><span class="inline-block align-middle size-6 ml-2 bg-green-500 rounded-lg"></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="border border-zinc-200 p-2 text-center">{{ api_key.expiration_date }}</td>
|
||||
<td class="border border-zinc-200 p-2 text-center">
|
||||
{% if api_key.revoked %}
|
||||
<span class="text-zinc-700">A revoked API Key cannot be revived</span>
|
||||
{% else %}
|
||||
<form action="/settings/revoke_api_key" method="POST">
|
||||
<input type="hidden" name="api_key_id" value="{{ api_key.id }}">
|
||||
<button type="submit" class="px-4 py-2 inline-block border border-red-700 bg-red-600 text-white rounded pointer-link">
|
||||
Revoke API Key
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue