aboutsummaryrefslogtreecommitdiff
path: root/app/templates/api/create_edit_token.html
blob: 53f503bd30903b477665fde6fb9411a5f91550ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{% 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 %}
		<form class="float-right" method="POST" action="{{ url_for('api.delete_token', username=token.owner.username, id=token.id) }}">
			<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
			<input class="btn btn-danger" type="submit" value="Delete">
		</form>
	{% endif %}

	<h1 class="mt-0">{{ self.title() }}</h1>

	<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>

	{% 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>
		</div>
	{% endif %}

	<form method="POST" action="" enctype="multipart/form-data">
		{{ form.hidden_tag() }}

		{{ render_field(form.name, placeholder="Human readable") }}
		{{ render_field(form.package) }}

		{{ render_submit_field(form.submit) }}
	</form>
{% endblock %}