OXYGENHUB
# 6e7dfa0a42b9 oxygenhub / templates / settings_tokens.html
2.6 KiB · HTML · last changed Device tokens expire and renew on use; the approval page shows the requester (closes #70) 1 month ago source blame history raw
1
{% extends "base.html" %}
2
{% import "settings_tabs.html" as t %}
3
{% block title %}Tokens{% endblock %}
4
{% block tabs %}{% call t::tabs("tokens") %}{% endblock %}
5
{% block content %}
6
<div class="head"><h1>Personal access tokens <small>{{ me.username }} · for oxy and the API</small></h1></div>
7
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
8
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
9
{% if let Some(f) = fresh %}
10
<div class="panel"><h2>Your new token</h2><p class="secret">{{ f }}</p>
11
<p class="small">In a checkout: <code>oxy config remote.&lt;name&gt;.token {{ f }}</code>, or set <code>OXY_TOKEN</code>.</p></div>
12
{% endif %}
13
{% if tokens.is_empty() %}<p class="empty">No tokens yet.</p>{% else %}
14
<div class="table"><table>
15
<tr><th>Name</th><th>Scopes</th><th>Repositories</th><th>Created</th><th>Last used</th><th>Expires</th><th></th></tr>
16
{% for t in tokens %}
17
<tr><td>{{ t.name }}</td><td>{{ t.scopes }}</td><td>{% if t.repos.is_empty() %}<span class="mute">all</span>{% else %}{{ t.repos }}{% endif %}</td>
18
<td><time title="{{ t.created_ms|when_i }}">{{ t.created_ms|ago_i }}</time></td>
19
<td>{% if let Some(u) = t.last_used_ms %}<time title="{{ u|when_i }}">{{ u|ago_i }}</time>{% else %}<span class="mute">never</span>{% endif %}</td>
20
<td>{% if let Some(x) = t.expires_ms %}{{ x|when_i }}{% if t.renew_ms.is_some() %} <span class="mute small">renewed on use</span>{% endif %}{% else %}<span class="mute">never</span>{% endif %}</td>
21
<td><form class="tiny" method="post" action="/settings/tokens/{{ t.id }}/delete"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button>delete</button></form></td></tr>
22
{% endfor %}
23
</table></div>
24
{% endif %}
25
<form class="card wide" method="post" action="/settings/tokens">
26
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
27
  <h2>New token</h2>
28
  <label for="name">Name</label><input type="text" id="name" name="name" required placeholder="laptop, CI, …">
29
  <label>Scopes</label>
30
  <div class="scopes">
31
    {% for (name, what) in scopes %}<label><input type="checkbox" name="scopes" value="{{ name }}"{% if *name == "repo:read" || *name == "repo:write" %} checked{% endif %}> <code>{{ name }}</code> <span class="small mute">{{ what }}</span></label>{% endfor %}
32
  </div>
33
  <label for="repos">Only these repositories (comma-separated owner/name; empty for all)</label><input type="text" id="repos" name="repos">
34
  <label for="expires_days">Expires after (days; empty for never)</label><input type="number" id="expires_days" name="expires_days" min="1">
35
  <button type="submit">CREATE TOKEN</button>
36
</form>
37
{% endblock %}