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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{% extends "layout.html" %}
{% block title %}account settings — kitgit{% endblock %}
{% block content %}
<section class="kg-section">
<span class="kg-kicker">settings</span>
<h1 class="kg-title">Account</h1>
<nav class="kg-tabs" aria-label="Settings">
<a href="/settings/profile">profile</a>
<a href="/settings/account" aria-current="page">account</a>
<a href="/settings/mfa">mfa</a>
<a href="/settings/keys">ssh / gpg</a>
</nav>
{% if let Some(err) = error %}
<div class="kg-flash">{{ err }}</div>
{% endif %}
{% if let Some(msg) = message %}
<div class="kg-flash">{{ msg }}</div>
{% endif %}
<div class="kg-settings-section" style="margin-top:1rem;border-top:0;padding-top:0">
<span class="kg-kicker">appearance</span>
<p class="kg-muted">Ink on paper by day, charcoal by night — or follow your system.</p>
<form class="kg-form" method="post" action="/settings/account/theme">
<label class="row">
<input type="radio" name="theme" value="light"{% if user.theme == "light" %} checked{% endif %} />
light
</label>
<label class="row">
<input type="radio" name="theme" value="dark"{% if user.theme == "dark" %} checked{% endif %} />
dark
</label>
<label class="row">
<input type="radio" name="theme" value="system"{% if user.theme != "light" && user.theme != "dark" %} checked{% endif %} />
system
</label>
<div class="kg-actions">
<button class="kg-btn" type="submit">save theme</button>
</div>
</form>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">username</span>
<form class="kg-form" method="post" action="/settings/account/username">
<label>
username
<input type="text" name="username" value="{{ user.username }}" required pattern="[a-z0-9][a-z0-9_-]{0,38}" />
</label>
<div class="kg-actions">
<button class="kg-btn" type="submit">change username</button>
</div>
</form>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">password</span>
<p class="kg-muted">Change your account password.</p>
<form class="kg-form" method="post" action="/settings/account/password">
<label>
current password
<input type="password" name="current_password" required autocomplete="current-password" />
</label>
<label>
new password
<input type="password" name="new_password" required minlength="8" autocomplete="new-password" />
</label>
<div class="kg-actions">
<button class="kg-btn" type="submit">change password</button>
</div>
</form>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">emails</span>
<p class="kg-muted">Emails are hidden on your profile unless you opt in. Extra addresses help match commit authors.</p>
<form class="kg-form" method="post" action="/settings/account/privacy">
<label class="row">
<input type="checkbox" name="show_email"{% if user.show_email %} checked{% endif %} />
show primary email on profile
</label>
<label class="row">
<input type="checkbox" name="vigilant_mode"{% if user.vigilant_mode %} checked{% endif %} />
vigilant mode (flag unsigned commits)
</label>
<div class="kg-actions">
<button class="kg-btn" type="submit">save privacy</button>
</div>
</form>
{% if !emails.is_empty() %}
<ul class="kg-list" style="margin-top:1rem">
{% for e in emails %}
<li>
<span>
{{ e.email }}
{% if e.is_primary %}<span class="kg-badge">primary</span>{% endif %}
{% if e.verified %}<span class="kg-badge">verified</span>{% endif %}
</span>
<span class="kg-actions">
{% if !e.is_primary %}
<form method="post" action="/settings/account/emails/{{ e.id }}/primary">
<button class="kg-btn kg-btn--ghost" type="submit">make primary</button>
</form>
<form method="post" action="/settings/account/emails/{{ e.id }}/delete">
<button class="kg-btn kg-btn--danger-ghost" type="submit">remove</button>
</form>
{% endif %}
</span>
</li>
{% endfor %}
</ul>
{% endif %}
<form class="kg-form" method="post" action="/settings/account/emails" style="margin-top:1rem">
<label>
add email
<input type="email" name="email" required />
</label>
<div class="kg-actions">
<button class="kg-btn" type="submit">add</button>
</div>
</form>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">two-factor authentication</span>
<p class="kg-muted">Add an authenticator app for an extra sign-in step.</p>
<div class="kg-actions">
<a class="kg-btn kg-btn--ghost" href="/settings/mfa">manage MFA</a>
</div>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">sessions</span>
{% if sessions.is_empty() %}
<p class="kg-muted">No active sessions.</p>
{% else %}
<ul class="kg-list">
{% for s in sessions %}
<li>
<span>
{% if s.is_current %}<span class="kg-badge">current</span>{% endif %}
<span class="kg-meta">{{ s.ip_address }}{% if !s.user_agent.is_empty() %} · {{ s.user_agent }}{% endif %}</span>
<span class="kg-meta">last seen {{ s.last_seen_at }}</span>
</span>
{% if !s.is_current %}
<form method="post" action="/settings/account/sessions/{{ s.id }}/revoke">
<button class="kg-btn kg-btn--danger-ghost" type="submit">revoke</button>
</form>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<form method="post" action="/settings/account/sessions/revoke-others" style="margin-top:1rem">
<button class="kg-btn kg-btn--ghost" type="submit">revoke other sessions</button>
</form>
</div>
<div class="kg-settings-section">
<span class="kg-kicker">security audit log</span>
<p class="kg-muted">Recent sign-ins and account changes for this account.</p>
{% if audit_entries.is_empty() %}
<p class="kg-muted">No audit events yet.</p>
{% else %}
<ul class="kg-list" style="margin-top:0.75rem">
{% for e in audit_entries %}
<li>
<span>
<strong>{{ e.action_label }}</strong>
<span class="kg-meta"> · {{ e.created_at }}</span>
{% if !e.ip.is_empty() %}
<span class="kg-meta"> · {{ e.ip }}</span>
{% endif %}
{% if !e.user_agent.is_empty() %}
<span class="kg-meta"> · {{ e.user_agent }}</span>
{% endif %}
{% if !e.metadata.is_empty() %}
<span class="kg-meta"> · <code>{{ e.metadata }}</code></span>
{% endif %}
</span>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="kg-settings-section">
<span class="kg-kicker">GDPR</span>
<div class="kg-actions">
<a class="kg-btn kg-btn--ghost" href="/settings/account/export">export my data</a>
</div>
</div>
<div class="kg-danger-zone">
<span class="kg-kicker">delete account</span>
<form class="kg-form" method="post" action="/settings/account/delete">
<div class="kg-danger-row">
<label class="kg-danger-confirm">
<span>type <code>{{ user.username }}</code> to delete</span>
<input type="text" name="confirm" required autocomplete="off" />
</label>
<button class="kg-btn kg-btn--danger" type="submit">delete account</button>
</div>
</form>
</div>
</section>
{% endblock %}