|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}SSH Keys — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<div class="mb-4"> |
|
6
|
<a href="{% url 'accounts:profile' %}" class="text-sm text-brand-light hover:text-brand">← Back to Profile</a> |
|
7
|
</div> |
|
8
|
<h1 class="text-2xl font-bold text-gray-100 mb-6">SSH Keys</h1> |
|
9
|
|
|
10
|
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6 mb-6"> |
|
11
|
<h2 class="text-lg font-semibold text-gray-200 mb-4">Add SSH Key</h2> |
|
12
|
<form method="post" class="space-y-4"> |
|
13
|
{% csrf_token %} |
|
14
|
<div> |
|
15
|
<label for="title" class="block text-sm font-medium text-gray-300 mb-1">Title</label> |
|
16
|
<input type="text" name="title" id="title" required placeholder="e.g. Work laptop" |
|
17
|
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"> |
|
18
|
</div> |
|
19
|
<div> |
|
20
|
<label for="public_key" class="block text-sm font-medium text-gray-300 mb-1">Public Key</label> |
|
21
|
<textarea name="public_key" id="public_key" rows="4" required |
|
22
|
placeholder="ssh-ed25519 AAAA... user@host" |
|
23
|
class="w-full rounded-md border-gray-600 bg-gray-900 text-gray-100 text-sm font-mono px-3 py-2 focus:border-brand focus:ring-brand"></textarea> |
|
24
|
<p class="mt-1 text-xs text-gray-500">Paste your public key (usually from ~/.ssh/id_ed25519.pub)</p> |
|
25
|
</div> |
|
26
|
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white hover:bg-brand-hover"> |
|
27
|
Add Key |
|
28
|
</button> |
|
29
|
</form> |
|
30
|
</div> |
|
31
|
|
|
32
|
{% if keys %} |
|
33
|
<div class="rounded-lg bg-gray-800 border border-gray-700"> |
|
34
|
<div class="p-4 border-b border-gray-700"> |
|
35
|
<h2 class="text-lg font-semibold text-gray-200">Your Keys</h2> |
|
36
|
</div> |
|
37
|
<div class="divide-y divide-gray-700"> |
|
38
|
{% for key in keys %} |
|
39
|
<div class="p-4 flex items-center justify-between"> |
|
40
|
<div> |
|
41
|
<div class="text-sm font-medium text-gray-200">{{ key.title }}</div> |
|
42
|
<div class="text-xs text-gray-500 font-mono mt-1">{{ key.fingerprint }}</div> |
|
43
|
<div class="text-xs text-gray-500 mt-1"> |
|
44
|
{{ key.key_type|upper }} · Added {{ key.created_at|timesince }} ago |
|
45
|
{% if key.last_used_at %}· Last used {{ key.last_used_at|timesince }} ago{% endif %} |
|
46
|
</div> |
|
47
|
</div> |
|
48
|
<form hx-post="{% url 'accounts:ssh_key_delete' pk=key.pk %}" hx-confirm="Delete SSH key '{{ key.title }}'?"> |
|
49
|
{% csrf_token %} |
|
50
|
<button type="submit" class="text-sm text-red-400 hover:text-red-300">Delete</button> |
|
51
|
</form> |
|
52
|
</div> |
|
53
|
{% endfor %} |
|
54
|
</div> |
|
55
|
</div> |
|
56
|
{% else %} |
|
57
|
<div class="text-center py-12 text-gray-500"> |
|
58
|
<p class="text-sm">No SSH keys added yet.</p> |
|
59
|
<p class="text-xs mt-1">Add an SSH key to clone and push Fossil repos over SSH.</p> |
|
60
|
</div> |
|
61
|
{% endif %} |
|
62
|
{% endblock %} |
|
63
|
|