2019-11-22 15:33:22 +01:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
{% if token %}
|
|
|
|
{{ _("Edit - %(name)s", name=token.name) }}
|
|
|
|
{% else %}
|
|
|
|
{{ _("Create API Token") }}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% from "macros/forms.html" import render_field, render_submit_field, render_radio_field %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
{% if token %}
|
2023-08-22 20:58:43 +02:00
|
|
|
<form class="float-end" method="POST" action="{{ url_for('api.delete_token', username=token.owner.username, id=token.id) }}">
|
2019-11-22 15:33:22 +01:00
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
2022-01-08 00:27:00 +01:00
|
|
|
<input class="btn btn-danger" type="submit" value="{{ _('Delete') }}">
|
2019-11-22 15:33:22 +01:00
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<h1 class="mt-0">{{ self.title() }}</h1>
|
|
|
|
|
2023-10-31 19:40:01 +01:00
|
|
|
{% if token.client %}
|
|
|
|
<p class="alert alert-info">
|
|
|
|
{{ _("This token was created by the application '%(title)s' by %(author)s.", title=token.client.title, author=token.client.owner.username) }}
|
|
|
|
{{ _("Click 'Delete' to revoke access.") }}
|
|
|
|
</p>
|
|
|
|
{% else %}
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
{{ _("API Tokens allow scripts to act on your behalf.") }}
|
|
|
|
{{ _("Be careful with what/whom you share tokens with, as you are responsible for your account's actions.") }}
|
|
|
|
</div>
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2023-10-31 19:40:01 +01:00
|
|
|
{% if token %}
|
|
|
|
<div class="card mb-3">
|
|
|
|
<div class="card-header">{{ _("Access Token") }}</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<p>
|
|
|
|
{{ _("For security reasons, access tokens will only be shown once. Reset the token if it is lost.") }}
|
|
|
|
</p>
|
|
|
|
{% if access_token %}
|
|
|
|
<input class="form-control my-3" type="text" readonly value="{{ access_token }}" class="form-control">
|
|
|
|
{% endif %}
|
|
|
|
<form method="POST" action="{{ url_for('api.reset_token', username=token.owner.username, id=token.id) }}">
|
|
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
|
|
<input class="btn btn-primary" type="submit" value="{{ _('Reset') }}">
|
|
|
|
</form>
|
|
|
|
</div>
|
2019-11-22 15:33:22 +01:00
|
|
|
</div>
|
2023-10-31 19:40:01 +01:00
|
|
|
{% endif %}
|
2019-11-22 15:33:22 +01:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<form method="POST" action="" enctype="multipart/form-data">
|
|
|
|
{{ form.hidden_tag() }}
|
|
|
|
|
2021-02-02 18:09:21 +01:00
|
|
|
{{ render_field(form.name, placeholder="Human readable", hint=_("Human-readable name to tell tokens apart.")) }}
|
|
|
|
{{ render_field(form.package, hint=_("Recommended: Only allows token to interact with a particular package.")) }}
|
2019-11-22 15:33:22 +01:00
|
|
|
|
|
|
|
{{ render_submit_field(form.submit) }}
|
|
|
|
</form>
|
|
|
|
{% endblock %}
|