|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}Generate Token — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<div class="max-w-2xl"> |
|
6
|
<div class="flex items-center gap-3 mb-6"> |
|
7
|
<a href="{% url 'accounts:profile' %}" class="text-gray-400 hover:text-white"> |
|
8
|
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"> |
|
9
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18" /> |
|
10
|
</svg> |
|
11
|
</a> |
|
12
|
<h1 class="text-2xl font-bold text-gray-100">Generate Personal Access Token</h1> |
|
13
|
</div> |
|
14
|
|
|
15
|
<form method="post" class="space-y-6"> |
|
16
|
{% csrf_token %} |
|
17
|
|
|
18
|
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6 space-y-4"> |
|
19
|
<div> |
|
20
|
<label for="name" class="block text-sm font-medium text-gray-300 mb-1">Token Name</label> |
|
21
|
<input type="text" name="name" id="name" required maxlength="200" |
|
22
|
placeholder="e.g. CI/CD pipeline, CLI access" |
|
23
|
class="w-full rounded-md border-gray-600 bg-gray-900 text-gray-100 text-sm px-3 py-2 focus:border-brand focus:ring-brand"> |
|
24
|
<p class="mt-1 text-xs text-gray-500">A descriptive name to remember what this token is for.</p> |
|
25
|
</div> |
|
26
|
|
|
27
|
<div> |
|
28
|
<label class="block text-sm font-medium text-gray-300 mb-2">Scopes</label> |
|
29
|
<div class="space-y-2"> |
|
30
|
<label class="flex items-center gap-3 cursor-pointer"> |
|
31
|
<input type="checkbox" name="scope_read" checked disabled |
|
32
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
33
|
<div> |
|
34
|
<span class="text-sm font-medium text-gray-200">read</span> |
|
35
|
<span class="text-xs text-gray-500 ml-2">Read access to repositories and data (always included)</span> |
|
36
|
</div> |
|
37
|
</label> |
|
38
|
<label class="flex items-center gap-3 cursor-pointer"> |
|
39
|
<input type="checkbox" name="scope_write" value="write" |
|
40
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
41
|
<div> |
|
42
|
<span class="text-sm font-medium text-gray-200">write</span> |
|
43
|
<span class="text-xs text-gray-500 ml-2">Push changes, create/update tickets and wiki</span> |
|
44
|
</div> |
|
45
|
</label> |
|
46
|
<label class="flex items-center gap-3 cursor-pointer"> |
|
47
|
<input type="checkbox" name="scope_admin" value="admin" |
|
48
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
49
|
<div> |
|
50
|
<span class="text-sm font-medium text-gray-200">admin</span> |
|
51
|
<span class="text-xs text-gray-500 ml-2">Full administrative access</span> |
|
52
|
</div> |
|
53
|
</label> |
|
54
|
</div> |
|
55
|
<input type="hidden" name="scopes" id="scopes_hidden" value="read"> |
|
56
|
</div> |
|
57
|
</div> |
|
58
|
|
|
59
|
<div class="flex items-center gap-3"> |
|
60
|
<button type="submit" onclick="buildScopes()" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white hover:bg-brand-hover"> |
|
61
|
Generate Token |
|
62
|
</button> |
|
63
|
<a href="{% url 'accounts:profile' %}" class="text-sm text-gray-400 hover:text-white">Cancel</a> |
|
64
|
</div> |
|
65
|
</form> |
|
66
|
</div> |
|
67
|
|
|
68
|
<script> |
|
69
|
function buildScopes() { |
|
70
|
var scopes = ['read']; |
|
71
|
if (document.querySelector('input[name="scope_write"]').checked) scopes.push('write'); |
|
72
|
if (document.querySelector('input[name="scope_admin"]').checked) scopes.push('admin'); |
|
73
|
document.getElementById('scopes_hidden').value = scopes.join(','); |
|
74
|
} |
|
75
|
</script> |
|
76
|
{% endblock %} |
|
77
|
|