internal/web/templates/account.html
263 lines · 15963 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="#export">Export</a></li>
26 <li><a href="#cli">On the command line</a></li>
27 <li><a href="#delete">Delete account</a></li>
28 </ul></div>
29</details>
30</nav>
31<div class="colmain">
32<section id="profile" class="setcard"><h2>Profile</h2>
33<p class="meta">Shown on your profile page, <a href="/{{.Viewer}}">/{{.Viewer}}</a>.</p>
34<form method="post" action="/settings" class="setform stack">
35 <input type="hidden" name="field" value="profile">
36 <label for="p-description">Description</label>
37 <input type="text" id="p-description" name="description" value="{{.Profile.Description}}" placeholder="one line, shown in listings">
38 <label for="p-website">Website</label>
39 <input type="text" id="p-website" name="website" value="{{.Profile.Website}}" placeholder="https://example.org">
40 <label for="p-links">Links</label>
41 <textarea id="p-links" name="links" rows="3" placeholder="one per line: label|https://… or a bare https://… (at most 5)">{{.LinksText}}</textarea>
42 <span class="btngroup"><button type="submit">Save profile</button></span>
43</form>
44<h3>About</h3>
45<p class="meta">The longer text below your repositories is a file:
46<code>profile/README.md</code> in <a href="/{{.AboutRepo}}">{{.AboutRepo}}</a>.
47Write it with a push, or edit it here.</p>
48{{if .AboutEdit}}<p><a class="button btn" href="{{.AboutEdit}}">Edit {{.Profile.AboutPath}}</a></p>
49{{else}}<form method="post" action="/settings" class="actions">
50 <input type="hidden" name="field" value="profile-repo">
51 <button type="submit" class="btn">Create {{.AboutRepo}}</button>
52</form>{{end}}
53</section>
54
55<section id="keys" class="setcard"><h2>SSH keys</h2>
56<p class="meta">Your keys are your identity here. A <code>full</code> key can run
57commands and push; a <code>git</code> key can only move git data (e.g., CI).</p>
58{{if .Keys}}<div class="tablewrap"><table class="keys nowrap">
59<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"><span class="vh">actions</span></th></tr>
60{{range .Keys}}<tr>
61 <td>{{.Label}}</td>
62 <td class="mono">{{.Fingerprint}}</td>
63 <td>{{.Algo}}</td>
64 <td><span class="chip">{{.Scope}}</span></td>
65 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
66 <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>
67 </div></details></td>
68</tr>
69{{end}}</table></div>
70{{else}}<p class="none">No SSH keys? Which cannot be right, since you signed in.</p>{{end}}
71<details class="editbox">
72 <summary>Add an SSH key</summary>
73 <form method="post" action="/settings" class="setform stack">
74 <input type="hidden" name="field" value="key-add">
75 <label for="key">Public key</label>
76 <textarea id="key" name="key" rows="3" required spellcheck="false" placeholder="ssh-ed25519 AAAA… you@machine"></textarea>
77 <label for="key-label">Label</label>
78 <input id="key-label" name="label" maxlength="64" placeholder="defaults to the key's comment">
79 <label for="scope">Scope</label>
80 <select id="scope" name="scope">
81 <option value="full">full: commands and git</option>
82 <option value="git">git: git transport only</option>
83 </select>
84 <span class="btngroup"><button type="submit">Add key</button></span>
85 </form>
86</details>
87</section>
88
89<section id="emails" class="setcard"><h2>Email addresses</h2>
90<p class="meta">A verified address ties signed commits to this
91account and where notifications go.</p>
92{{if .Emails}}<ul class="plain">
93{{range .Emails}}<li><span>{{.Address}}</span>
94 {{if .Primary}}<span class="chip">primary</span>{{end}}
95 {{if .Verified}}<span class="badge badge-verified">verified{{with .VerifiedBy}} · {{.}}{{end}}</span>
96 {{else}}<span class="badge badge-unsigned">unverified</span>{{end}}
97 {{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}}
98 <details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
99 <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>
100 </div></details>{{end}}</li>
101{{end}}</ul>{{end}}
102<details class="editbox">
103 <summary>Add or verify an address</summary>
104 <form method="post" action="/settings" class="setform">
105 <input type="hidden" name="field" value="email-add">
106 <label for="address">Address</label>
107 <input type="email" id="address" name="address" required autocomplete="email" placeholder="you@example.org">
108 <button type="submit" class="btn">Send code</button>
109 </form>
110 <form method="post" action="/settings" class="setform">
111 <input type="hidden" name="field" value="email-verify">
112 <label for="code">Verification code</label>
113 <input type="text" id="code" name="code" required autocomplete="one-time-code" autocapitalize="none" spellcheck="false" placeholder="from the mail">
114 <button type="submit" class="btn">Verify</button>
115 </form>
116</details>
117</section>
118
119<section id="pgp" class="setcard"><h2>OpenPGP keys</h2>
120<p class="meta">Only needed if you sign commits with GPG. SSH signing
121(<code>gpg.format = ssh</code>) uses the keys above.</p>
122{{if .PGP}}<div class="tablewrap"><table class="keys">
123<tr class="cols"><th scope="col">fingerprint</th><th scope="col">identities</th><th scope="col"><span class="vh">actions</span></th></tr>
124{{range .PGP}}<tr>
125 <td class="mono">{{.Fingerprint}}</td>
126 <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>
127 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
128 <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>
129 </div></details></td>
130</tr>
131{{end}}</table></div>
132{{else}}<p class="none">No OpenPGP keys.</p>{{end}}
133<details class="editbox">
134 <summary>Add a PGP key</summary>
135 <form method="post" action="/settings" class="setform stack">
136 <input type="hidden" name="field" value="pgp-add">
137 <label for="pgpkey">Armored public key</label>
138 <textarea id="pgpkey" name="key" rows="6" required placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----"></textarea>
139 <span class="btngroup"><button type="submit">Add key</button></span>
140 </form>
141</details>
142</section>
143
144<section id="notifications" class="setcard"><h2>Notifications</h2>
145<form method="post" action="/settings" class="setform" data-autosave="1">
146 <input type="hidden" name="field" value="notify-mail">
147 <div><label for="notify-mail">Activity by mail</label><p class="hint">Receive activity alerts by email. Login links arrive regardless.</p></div>
148 <div class="check"><input type="checkbox" id="notify-mail" name="mail" value="on"{{if .MailOn}} checked{{end}}></div>
149 <button type="submit" class="btn">Save</button>
150</form>
151{{if .ReplyOffered}}<form method="post" action="/settings" class="setform" data-autosave="1">
152 <input type="hidden" name="field" value="notify-reply">
153 <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>
154 <div class="check"><input type="checkbox" id="notify-reply" name="reply" value="on"{{if .ReplyOn}} checked{{end}}></div>
155 <button type="submit" class="btn">Save</button>
156</form>{{end}}
157<form method="post" action="/settings" class="setform" data-autosave="1">
158 <input type="hidden" name="field" value="notify-watch">
159 <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>
160 <div class="check"><input type="checkbox" id="notify-watch" name="watch" value="on"{{if .WatchOn}} checked{{end}}></div>
161 <button type="submit" class="btn">Save</button>
162</form>
163<form method="post" action="/settings" class="setform" data-autosave="1">
164 <input type="hidden" name="field" value="notify-push">
165 <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>
166 <div class="check"><input type="checkbox" id="notify-push" name="push" value="on"{{if .PushOn}} checked{{end}}></div>
167 <button type="submit" class="btn">Save</button>
168</form>
169<h3>Devices</h3>
170{{if .Devices}}<div class="tablewrap"><table class="keys nowrap">
171<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>
172{{range .Devices}}<tr>
173 <td class="mono">{{.ID}}</td>
174 <td>{{.Label}}</td>
175 <td class="mono">{{.Token}}</td>
176 <td>{{if .LastSeenAt}}{{when .LastSeenAt}}{{else}}never{{end}}</td>
177 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
178 <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>
179 </div></details></td>
180</tr>
181{{end}}</table></div>
182{{else}}<p class="none">No registered devices.</p>{{end}}
183<p class="meta">Devices register themselves from the iOS app; a browser cannot produce an APNs token.</p>
184</section>
185
186<section id="appearance" class="setcard"><h2>Appearance</h2>
187<form method="post" action="/settings" class="setform" data-autosave="1">
188 <input type="hidden" name="field" value="theme">
189 <div><label for="theme">Colour scheme</label><p class="hint">Matches <code>gitbay web theme set</code>.</p></div>
190 <select id="theme" name="theme" data-live-theme="1">
191 <option value="system"{{if eq .ThemeSetting "system"}} selected{{end}}>Follow the browser</option>
192 <option value="light"{{if eq .ThemeSetting "light"}} selected{{end}}>Light</option>
193 <option value="dark"{{if eq .ThemeSetting "dark"}} selected{{end}}>Dark</option>
194 </select>
195 <button type="submit" class="btn">Save</button>
196</form>
197<form method="post" action="/settings" class="setform" data-autosave="1">
198 <input type="hidden" name="field" value="diff-layout">
199 <div><label for="layout">Diff layout</label><p class="hint">Matches <code>gitbay web diff set</code>. Narrow windows stay unified.</p></div>
200 <select id="layout" name="layout">
201 <option value="unified"{{if ne .DiffSetting "split"}} selected{{end}}>Unified</option>
202 <option value="split"{{if eq .DiffSetting "split"}} selected{{end}}>Side by side</option>
203 </select>
204 <button type="submit" class="btn">Save</button>
205</form>
206</section>
207
208<section id="tokens" class="setcard"><h2>API tokens</h2>
209<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>
210{{if .TokenShown}}<p class="notice" role="status">Token created. It is shown once; store it now.</p>
211<pre class="message copyable" tabindex="0"><code>{{.TokenShown}}</code></pre>{{end}}
212{{if .Tokens}}<div class="tablewrap"><table class="keys nowrap">
213<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>
214{{range .Tokens}}<tr>
215 <td>{{.Name}}</td>
216 <td>{{.Scope}}</td>
217 <td>{{when .Created}}</td>
218 <td>{{.Expires}}</td>
219 <td>{{.LastUsed}}</td>
220 <td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Revoke</summary><div class="popmenu">
221 <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>
222 </div></details></td>
223</tr>
224{{end}}</table></div>
225{{else}}<p class="none">No API tokens.</p>{{end}}
226<details class="editbox">
227 <summary>Create a token</summary>
228 <form method="post" action="/settings" class="setform stack">
229 <input type="hidden" name="field" value="token-create">
230 <label for="token-name">Name</label>
231 <input id="token-name" name="name" required autocomplete="off" placeholder="e.g. iphone">
232 <label for="token-scope">Scope</label>
233 <select id="token-scope" name="scope">
234 <option value="read" selected>read: read-only commands</option>
235 <option value="full">full: everything your account can do</option>
236 </select>
237 <label for="token-ttl">Expires after</label>
238 <input id="token-ttl" name="ttl" autocomplete="off" placeholder="e.g. 30d or 720h; empty never expires">
239 <span class="btngroup"><button type="submit">Create token</button></span>
240 </form>
241</details>
242</section>
243
244<section id="export" class="setcard"><h2>Export</h2>
245<p class="meta">Your profile, repositories, issues and merge requests as one JSON bundle, matching <code>gitbay auth export</code>. Keys are excluded.</p>
246<p><a class="button btn" href="/settings/export">Download bundle</a></p>
247</section>
248
249<section id="cli" class="setcard"><h2>On the command line</h2>
250<p class="meta">Browser sessions and instance administration also run from the CLI or stock OpenSSH:</p>
251<pre class="message copyable" tabindex="0"><code>gitbay web sessions list
252ssh git@{{.Host}} whoami</code></pre>
253</section>
254
255<section id="delete" class="setcard setcard-danger"><h2>Delete account</h2>
256<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>
257<details class="popover"><summary class="button danger">Delete account…</summary><div class="popmenu">
258 <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>
259</div></details>
260</section>
261</div>
262</div>
263{{end}}