{% extends shell('app') %} {% from 'apikeys/macros.html' import token_state %} {% block title %}{{ _('API tokens') }}{% endblock %} {% block content %}

{{ _('API tokens') }}

{{ _('Tokens let the splent command line act on your behalf. The token itself is shown once, when you create it, and is never stored here.') }}

{% if unrevoked %}
{{ revoke_all_form.hidden_tag() }}
{% endif %} {{ _('New token') }}
{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %}
{% for category, message in messages %}
{{ message }}
{% endfor %}
{% endif %} {% endwith %} {% if tokens %}
{# Pinned to the right in the panel (admin's panel.css), so Revoke stays in view on a phone. #} {% for token in tokens %} {% endfor %}
{{ _('Name') }} {{ _('Token') }} {{ _('Scopes') }} {{ _('Created') }} {{ _('Expires') }} {{ _('Last used') }} {{ _('State') }}
{{ token.name }} {{ token.prefix }}... {% for scope in token.scope_list %} {{ scope }} {% endfor %} {{ token.created_at.strftime('%Y-%m-%d %H:%M') if token.created_at else '' }} {% if token.expires_at %} {{ token.expires_at.strftime('%Y-%m-%d %H:%M') }} {% else %} {{ _('Never') }} {% endif %} {% if token.last_used_at %} {{ token.last_used_at.strftime('%Y-%m-%d %H:%M') }} {% else %} {{ _('Never') }} {% endif %} {{ token_state(token) }} {% if not token.is_revoked %} {# The name is the developer's own text, so it reaches the script as plain text turned into JSON, in a single quoted attribute no quote in it can leave. #}
{{ revoke_form.hidden_tag() }}
{% endif %}
{% else %}
{{ _('You have no tokens yet. Create one to use the splent command line.') }}
{% endif %} {% endblock %}