19bb31ff Andy McCall 1 month ago ↶
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 }}{% 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 >
b45384c9 Andy McCall 1 month ago ↶
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 %}
19bb31ff Andy McCall 1 month ago ↶
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 %}