internal/web/templates/account.html
291 lines · 17570 bytes
1{{define "width"}}wide{{end}}
2{{define "title"}}account settings{{end}}
3{{define "content"}}
4<div class="pagehead">
5 <h1>Account settings</h1>
6 <span class="grow"></span>
7 <a class="button btn" href="/{{.Viewer}}">View profile</a>
8</div>
9{{if .Notice}}<p class="error" role="alert">{{.Notice}}{{if .Reauth}} <a href="/login">Sign in again</a>{{end}}</p>{{end}}
10{{if .Message}}<p class="notice" role="status">{{.Message}}</p>{{end}}
11
12<div class="withcol narrow">
13<nav class="sidecol sticky" aria-label="Sections" data-scrollspy="1">
14<details class="sidedrop">
15<summary><span class="sideword">Sections</span></summary>
16 <div class="grp"><h2 class="colhead">Sections</h2>
17 <ul>
18 <li><a href="#profile">Profile</a></li>
19 <li><a href="#keys">SSH keys</a></li>
20 <li><a href="#emails">Email addresses</a></li>
21 <li><a href="#pgp">OpenPGP keys</a></li>
22 <li><a href="#notifications">Notifications</a></li>
23 <li><a href="#appearance">Appearance</a></li>
24 <li><a href="#tokens">API tokens</a></li>
25 <li><a href="#sessions">Browser sessions</a></li>
26 <li><a href="#export">Export</a></li>
27 <li><a href="#cli">On the command line</a></li>
28 <li><a href="#delete">Delete account</a></li>
29 </ul></div>
30</details>
31</nav>
32<div class="colmain">
33<section id="profile" class="setcard"><h2>Profile</h2>
34<p class="meta">Shown on your profile page, <a href="/{{.Viewer}}">/{{.Viewer}}</a>.</p>
35<form method="post" action="/settings" class="setform stack">
36 <input type="hidden" name="field" value="profile">
37 <label for="p-description">Description</label>
38 <input type="text" id="p-description" name="description" value="{{.Profile.Description}}" placeholder="one line, shown in listings">
39 <label for="p-website">Website</label>
40 <input type="text" id="p-website" name="website" value="{{.Profile.Website}}" placeholder="https://example.org">
41 <label for="p-links">Links</label>
42 <textarea id="p-links" name="links" rows="3" placeholder="one per line: label|https://… or a bare https://… (at most 5)">{{.LinksText}}</textarea>
43 <span class="btngroup"><button type="submit">Save profile</button></span>
44</form>
45<h3>About</h3>
46<p class="meta">The longer text below your repositories is a file:
47<code>profile/README.md</code> in <a href="/{{.AboutRepo}}">{{.AboutRepo}}</a>.
48Write it with a push, or edit it here.</p>
49{{if .AboutEdit}}<p><a class="button btn" href="{{.AboutEdit}}">Edit {{.Profile.AboutPath}}</a></p>
50{{else}}<form method="post" action="/settings" class="actions">
51 <input type="hidden" name="field" value="profile-repo">
52 <button type="submit" class="btn">Create {{.AboutRepo}}</button>
53</form>{{end}}
54</section>
55
56<section id="keys" class="setcard"><h2>SSH keys</h2>
57<p class="meta">Your keys are your identity here. A <code>full</code> key can run
58commands and push; a <code>git</code> key can only move git data (e.g., CI).</p>
59{{if .Keys}}<div class="tablewrap"><table class="keys nowrap">
60<tr class="cols"><th scope="col">label</th><th scope="col">fingerprint</th><th scope="col">type</th><th scope="col">scope</th><th scope="col">last used</th><th scope="col">expires</th><th scope="col"><span class="vh">actions</span></th></tr>
61{{range .Keys}}<tr>
62 <td>{{.Label}}</td>
63 <td class="mono">{{.Fingerprint}}</td>
64 <td>{{.Algo}}</td>
65 <td><span class="chip">{{.Scope}}</span></td>
66 <td>{{if .LastUsed}}{{when .LastUsed}}{{else}}never{{end}}</td>
67 <td>{{.Expires}}</td>
68 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
69 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="key-remove"><input type="hidden" name="fingerprint" value="{{.Fingerprint}}">{{template "confirmfield" .Confirm}}<button type="submit" class="danger">Remove</button></form>
70 </div></details></td>
71</tr>
72{{end}}</table></div>
73{{else}}<p class="none">No SSH keys? Which cannot be right, since you signed in.</p>{{end}}
74<details class="editbox">
75 <summary>Add an SSH key</summary>
76 <form method="post" action="/settings" class="setform stack">
77 <input type="hidden" name="field" value="key-add">
78 <label for="key">Public key</label>
79 <textarea id="key" name="key" rows="3" required spellcheck="false" placeholder="ssh-ed25519 AAAA… you@machine"></textarea>
80 <label for="key-label">Label</label>
81 <input id="key-label" name="label" maxlength="64" placeholder="defaults to the key's comment">
82 <label for="scope">Scope</label>
83 <select id="scope" name="scope">
84 <option value="full">full: commands and git</option>
85 <option value="git">git: git transport only</option>
86 </select>
87 <label for="key-ttl">Expires after</label>
88 <input id="key-ttl" name="ttl" autocomplete="off" placeholder="e.g. 30d or 720h; empty never expires">
89 <span class="btngroup"><button type="submit">Add key</button></span>
90 </form>
91</details>
92</section>
93
94<section id="emails" class="setcard"><h2>Email addresses</h2>
95<p class="meta">A verified address ties signed commits to this
96account and where notifications go.</p>
97{{if .Emails}}<ul class="plain">
98{{range .Emails}}<li><span>{{.Address}}</span>
99 {{if .Primary}}<span class="chip">primary</span>{{end}}
100 {{if .Verified}}<span class="badge badge-verified">verified{{with .VerifiedBy}} · {{.}}{{end}}</span>
101 {{else}}<span class="badge badge-unsigned">unverified</span>{{end}}
102 {{if not .Primary}}{{if .Verified}}<form method="post" action="/settings" class="inline"><input type="hidden" name="field" value="email-primary"><input type="hidden" name="address" value="{{.Address}}"><button type="submit" class="linklike">Make primary</button></form>{{end}}
103 <details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
104 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="email-remove"><input type="hidden" name="address" value="{{.Address}}">{{template "confirmfield" .Address}}<button type="submit" class="danger">Remove</button></form>
105 </div></details>{{end}}</li>
106{{end}}</ul>{{end}}
107<details class="editbox">
108 <summary>Add or verify an address</summary>
109 <form method="post" action="/settings" class="setform">
110 <input type="hidden" name="field" value="email-add">
111 <label for="address">Address</label>
112 <input type="email" id="address" name="address" required autocomplete="email" placeholder="you@example.org">
113 <button type="submit" class="btn">Send code</button>
114 </form>
115 <form method="post" action="/settings" class="setform">
116 <input type="hidden" name="field" value="email-verify">
117 <label for="code">Verification code</label>
118 <input type="text" id="code" name="code" required autocomplete="one-time-code" autocapitalize="none" spellcheck="false" placeholder="from the mail">
119 <button type="submit" class="btn">Verify</button>
120 </form>
121</details>
122</section>
123
124<section id="pgp" class="setcard"><h2>OpenPGP keys</h2>
125<p class="meta">Only needed if you sign commits with GPG. SSH signing
126(<code>gpg.format = ssh</code>) uses the keys above.</p>
127{{if .PGP}}<div class="tablewrap"><table class="keys">
128<tr class="cols"><th scope="col">fingerprint</th><th scope="col">identities</th><th scope="col"><span class="vh">actions</span></th></tr>
129{{range .PGP}}<tr>
130 <td class="mono">{{.Fingerprint}}</td>
131 <td>{{range .UIDs}}{{.}}<br>{{end}}{{if .Revoked}}<span class="badge badge-bad_signature">revoked</span>{{else if .Expired}}<span class="badge badge-signed_key_expired">expired</span>{{end}}</td>
132 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
133 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="pgp-remove"><input type="hidden" name="fingerprint" value="{{.Fingerprint}}">{{template "confirmfield" .Confirm}}<button type="submit" class="danger">Remove</button></form>
134 </div></details></td>
135</tr>
136{{end}}</table></div>
137{{else}}<p class="none">No OpenPGP keys.</p>{{end}}
138<details class="editbox">
139 <summary>Add a PGP key</summary>
140 <form method="post" action="/settings" class="setform stack">
141 <input type="hidden" name="field" value="pgp-add">
142 <label for="pgpkey">Armored public key</label>
143 <textarea id="pgpkey" name="key" rows="6" required placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----"></textarea>
144 <span class="btngroup"><button type="submit">Add key</button></span>
145 </form>
146</details>
147</section>
148
149<section id="notifications" class="setcard"><h2>Notifications</h2>
150<form method="post" action="/settings" class="setform" data-autosave="1">
151 <input type="hidden" name="field" value="notify-mail">
152 <div><label for="notify-mail">Activity by mail</label><p class="hint">Receive activity alerts by email. Login links arrive regardless.</p></div>
153 <div class="check"><input type="checkbox" id="notify-mail" name="mail" value="on"{{if .MailOn}} checked{{end}}></div>
154 <button type="submit" class="btn">Save</button>
155</form>
156{{if .ReplyOffered}}<form method="post" action="/settings" class="setform" data-autosave="1">
157 <input type="hidden" name="field" value="notify-reply">
158 <div><label for="notify-reply">Reply to mail to comment</label><p class="hint">Issue and MR mail gets a reply address; replies from verified addresses post as comments.</p></div>
159 <div class="check"><input type="checkbox" id="notify-reply" name="reply" value="on"{{if .ReplyOn}} checked{{end}}></div>
160 <button type="submit" class="btn">Save</button>
161</form>{{end}}
162<form method="post" action="/settings" class="setform" data-autosave="1">
163 <input type="hidden" name="field" value="notify-watch">
164 <div><label for="notify-watch">Watch repositories you can write to</label><p class="hint">Alerts for every issue and MR on writable repos unless overridden per repo.</p></div>
165 <div class="check"><input type="checkbox" id="notify-watch" name="watch" value="on"{{if .WatchOn}} checked{{end}}></div>
166 <button type="submit" class="btn">Save</button>
167</form>
168<form method="post" action="/settings" class="setform" data-autosave="1">
169 <input type="hidden" name="field" value="notify-push">
170 <div><label for="notify-push">Activity on your registered devices</label><p class="hint">Sends notification text to Apple devices registered in the iOS app.</p></div>
171 <div class="check"><input type="checkbox" id="notify-push" name="push" value="on"{{if .PushOn}} checked{{end}}></div>
172 <button type="submit" class="btn">Save</button>
173</form>
174<h3>Devices</h3>
175{{if .Devices}}<div class="tablewrap"><table class="keys nowrap">
176<tr class="cols"><th scope="col">id</th><th scope="col">label</th><th scope="col">token</th><th scope="col">last seen</th><th scope="col"><span class="vh">actions</span></th></tr>
177{{range .Devices}}<tr>
178 <td class="mono">{{.ID}}</td>
179 <td>{{.Label}}</td>
180 <td class="mono">{{.Token}}</td>
181 <td>{{if .LastSeenAt}}{{when .LastSeenAt}}{{else}}never{{end}}</td>
182 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
183 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="device-remove"><input type="hidden" name="id" value="{{.ID}}">{{template "confirmfield" .Confirm}}<button type="submit" class="danger">Remove</button></form>
184 </div></details></td>
185</tr>
186{{end}}</table></div>
187{{else}}<p class="none">No registered devices.</p>{{end}}
188<p class="meta">Devices register themselves from the iOS app; a browser cannot produce an APNs token.</p>
189</section>
190
191<section id="appearance" class="setcard"><h2>Appearance</h2>
192<form method="post" action="/settings" class="setform" data-autosave="1">
193 <input type="hidden" name="field" value="theme">
194 <div><label for="theme">Colour scheme</label><p class="hint">Matches <code>gitbay web theme set</code>.</p></div>
195 <select id="theme" name="theme" data-live-theme="1">
196 <option value="system"{{if eq .ThemeSetting "system"}} selected{{end}}>Follow the browser</option>
197 <option value="light"{{if eq .ThemeSetting "light"}} selected{{end}}>Light</option>
198 <option value="dark"{{if eq .ThemeSetting "dark"}} selected{{end}}>Dark</option>
199 </select>
200 <button type="submit" class="btn">Save</button>
201</form>
202<form method="post" action="/settings" class="setform" data-autosave="1">
203 <input type="hidden" name="field" value="diff-layout">
204 <div><label for="layout">Diff layout</label><p class="hint">Matches <code>gitbay web diff set</code>. Narrow windows stay unified.</p></div>
205 <select id="layout" name="layout">
206 <option value="unified"{{if ne .DiffSetting "split"}} selected{{end}}>Unified</option>
207 <option value="split"{{if eq .DiffSetting "split"}} selected{{end}}>Side by side</option>
208 </select>
209 <button type="submit" class="btn">Save</button>
210</form>
211</section>
212
213<section id="tokens" class="setcard"><h2>API tokens</h2>
214<p class="meta">A token signs in the iOS app or a script. Give each token the narrowest scope and shortest lifetime the job needs.</p>
215{{if .TokenShown}}<p class="notice" role="status">Token created. It is shown once; store it now.</p>
216<pre class="message copyable" tabindex="0"><code>{{.TokenShown}}</code></pre>{{end}}
217{{if .Tokens}}<div class="tablewrap"><table class="keys nowrap">
218<tr class="cols"><th scope="col">name</th><th scope="col">scope</th><th scope="col">created</th><th scope="col">expires</th><th scope="col">last used</th><th scope="col"><span class="vh">actions</span></th></tr>
219{{range .Tokens}}<tr>
220 <td>{{.Name}}</td>
221 <td>{{.Scope}}</td>
222 <td>{{when .Created}}</td>
223 <td>{{.Expires}}</td>
224 <td>{{.LastUsed}}</td>
225 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Revoke</summary><div class="popmenu">
226 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="token-revoke"><input type="hidden" name="name" value="{{.Name}}">{{template "confirmfield" .Name}}<button type="submit" class="danger">Revoke</button></form>
227 </div></details></td>
228</tr>
229{{end}}</table></div>
230{{else}}<p class="none">No API tokens.</p>{{end}}
231<details class="editbox">
232 <summary>Create a token</summary>
233 <form method="post" action="/settings" class="setform stack">
234 <input type="hidden" name="field" value="token-create">
235 <label for="token-name">Name</label>
236 <input id="token-name" name="name" required autocomplete="off" placeholder="e.g. iphone">
237 <label for="token-scope">Scope</label>
238 <select id="token-scope" name="scope">
239 <option value="read" selected>read: read-only commands</option>
240 <option value="full">full: everything your account can do</option>
241 </select>
242 <label for="token-ttl">Expires after</label>
243 <input id="token-ttl" name="ttl" autocomplete="off" placeholder="e.g. 30d or 720h; empty never expires">
244 <span class="btngroup"><button type="submit">Create token</button></span>
245 </form>
246</details>
247</section>
248
249<section id="sessions" class="setcard"><h2>Browser sessions</h2>
250<p class="meta">Active browser sessions on your account, matching <code>gitbay web sessions list</code>.</p>
251{{if .Sessions}}<div class="tablewrap"><table class="keys nowrap">
252<tr class="cols"><th scope="col">id</th><th scope="col">signed in</th><th scope="col">last used</th><th scope="col">expires</th><th scope="col"><span class="vh">actions</span></th></tr>
253{{range .Sessions}}<tr>
254 <td class="mono">{{.ID}}{{if eq .ID $.CurrentSession}} <span class="chip">this browser</span>{{end}}</td>
255 <td>{{when .CreatedAt}}</td>
256 <td>{{if .LastUsedAt}}{{when .LastUsedAt}}{{else}}never{{end}}</td>
257 <td>{{when .ExpiresAt}}</td>
258 <td class="act"><form method="post" action="/settings" class="inline">
259 <input type="hidden" name="field" value="session-revoke">
260 <input type="hidden" name="id" value="{{.ID}}">
261 <button type="submit" class="danger">End</button>
262 </form></td>
263</tr>
264{{end}}</table></div>
265<form method="post" action="/settings" class="actions">
266 <input type="hidden" name="field" value="session-revoke-all">
267 <button type="submit" class="danger">End all browser sessions</button>
268</form>
269{{else}}<p class="none">No active browser sessions.</p>{{end}}
270</section>
271
272<section id="export" class="setcard"><h2>Export</h2>
273<p class="meta">Your profile, repositories, issues and merge requests as one JSON bundle, matching <code>gitbay auth export</code>. Keys are excluded.</p>
274<p><a class="button btn" href="/settings/export">Download bundle</a></p>
275</section>
276
277<section id="cli" class="setcard"><h2>On the command line</h2>
278<p class="meta">Browser sessions and instance administration also run from the CLI or stock OpenSSH:</p>
279<pre class="message copyable" tabindex="0"><code>gitbay web sessions list
280ssh git@{{.Host}} whoami</code></pre>
281</section>
282
283<section id="delete" class="setcard setcard-danger"><h2>Delete account</h2>
284<p class="meta">Deletes your repositories, snippets, keys and addresses. Issues, merge requests and comments on other people's repositories stay under <code>ghost</code>. A confirmation link is mailed to your primary address; opening it disables the account and purges it seven days later. <a href="#export">Export</a> first to keep a copy.</p>
285<details class="popover"><summary class="button danger">Delete account…</summary><div class="popmenu">
286 <form method="post" action="/settings" class="popform"><input type="hidden" name="field" value="account-delete">{{template "confirmfield" .Viewer}}<button type="submit" class="danger">Mail link</button></form>
287</div></details>
288</section>
289</div>
290</div>
291{{end}}