internal/web/templates/account.html

112 lines · 5867 bytes

  1{{define "title"}}account settings{{end}}
  2{{define "content"}}
  3<h1>Account settings</h1>
  4{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
  5{{if .Message}}<p class="notice" role="status">{{.Message}}</p>{{end}}
  6
  7<h2>Profile</h2>
  8<p class="meta">Shown on your profile page, <a href="/{{.Viewer}}">/{{.Viewer}}</a>.</p>
  9<form method="post" action="/settings" class="setform stack">
 10  <input type="hidden" name="field" value="profile">
 11  <label for="p-description">Description</label>
 12  <input type="text" id="p-description" name="description" value="{{.Profile.Description}}" placeholder="one line, shown in listings">
 13  <label for="p-website">Website</label>
 14  <input type="text" id="p-website" name="website" value="{{.Profile.Website}}" placeholder="https://example.org">
 15  <label for="p-links">Links</label>
 16  <textarea id="p-links" name="links" rows="3" placeholder="one per line: label|https://... or a bare https://... (at most 5)">{{.LinksText}}</textarea>
 17  <label for="p-about">About</label>
 18  <textarea id="p-about" name="about" rows="8" placeholder="longer, shown below your repositories">{{.Profile.About}}</textarea>
 19  {{template "formatpicker" .Profile.AboutFormat}}
 20  <button type="submit">Save profile</button>
 21</form>
 22
 23<h2>SSH keys</h2>
 24<p class="meta">Your keys are your identity here. A <code>full</code> key can run
 25commands and push; a <code>git</code> key can only move git data, which is what
 26a CI checkout wants.</p>
 27{{if .Keys}}<div class="tablewrap"><table class="keys">
 28<tr class="cols"><th scope="col">fingerprint</th><th scope="col">type</th><th scope="col">scope</th><th scope="col"></th></tr>
 29{{range .Keys}}<tr>
 30  <td class="mono">{{.Fingerprint}}</td>
 31  <td>{{.Algo}}</td>
 32  <td>{{.Scope}}</td>
 33  <td class="act"><form method="post" action="/settings"><input type="hidden" name="field" value="key-remove"><input type="hidden" name="fingerprint" value="{{.Fingerprint}}"><button type="submit" class="linklike">Remove</button></form></td>
 34</tr>
 35{{end}}</table></div>
 36{{else}}<p class="none">No SSH keys — which cannot be right, since you signed in.</p>{{end}}
 37<details class="editbox">
 38  <summary>Add an SSH key</summary>
 39  <form method="post" action="/settings" class="setform stack">
 40    <input type="hidden" name="field" value="key-add">
 41    <label for="key">Public key</label>
 42    <textarea id="key" name="key" rows="3" required placeholder="ssh-ed25519 AAAA... you@machine"></textarea>
 43    <label for="scope">Scope</label>
 44    <select id="scope" name="scope">
 45      <option value="full">full — commands and git</option>
 46      <option value="git">git — git transport only</option>
 47    </select>
 48    <button type="submit">Add key</button>
 49  </form>
 50</details>
 51
 52<h2>Email addresses</h2>
 53<p class="meta">A verified address is what ties your signed commits to this
 54account, and where notifications go.</p>
 55{{if .Emails}}<ul class="plain">
 56{{range .Emails}}<li>{{.Address}}
 57  {{if .Primary}}<span class="chip">primary</span>{{end}}
 58  {{if .Verified}}<span class="badge badge-verified">verified{{with .VerifiedBy}} · {{.}}{{end}}</span>
 59  {{else}}<span class="badge badge-unsigned">unverified</span>{{end}}</li>
 60{{end}}</ul>{{end}}
 61<details class="editbox">
 62  <summary>Add an address</summary>
 63  <form method="post" action="/settings" class="setform">
 64    <input type="hidden" name="field" value="email-add">
 65    <label for="address">Address</label>
 66    <input type="email" id="address" name="address" required placeholder="you@example.org">
 67    <button type="submit">Send code</button>
 68  </form>
 69  <form method="post" action="/settings" class="setform">
 70    <input type="hidden" name="field" value="email-verify">
 71    <label for="code">Verification code</label>
 72    <input type="text" id="code" name="code" required placeholder="from the mail">
 73    <button type="submit">Verify</button>
 74  </form>
 75</details>
 76
 77<h2>OpenPGP keys</h2>
 78<p class="meta">Only needed if you sign commits with GPG. SSH signing
 79(<code>gpg.format = ssh</code>) uses the keys above.</p>
 80{{if .PGP}}<div class="tablewrap"><table class="keys">
 81<tr class="cols"><th scope="col">fingerprint</th><th scope="col">identities</th><th scope="col"></th></tr>
 82{{range .PGP}}<tr>
 83  <td class="mono">{{.Fingerprint}}</td>
 84  <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>
 85  <td class="act"><form method="post" action="/settings"><input type="hidden" name="field" value="pgp-remove"><input type="hidden" name="fingerprint" value="{{.Fingerprint}}"><button type="submit" class="linklike">Remove</button></form></td>
 86</tr>
 87{{end}}</table></div>
 88{{else}}<p class="none">No OpenPGP keys.</p>{{end}}
 89<details class="editbox">
 90  <summary>Add a PGP key</summary>
 91  <form method="post" action="/settings" class="setform stack">
 92    <input type="hidden" name="field" value="pgp-add">
 93    <label for="pgpkey">Armored public key</label>
 94    <textarea id="pgpkey" name="key" rows="6" required placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----"></textarea>
 95    <button type="submit">Add key</button>
 96  </form>
 97</details>
 98
 99<h2>Export</h2>
100<p class="meta">Your profile, repositories, issues and merge requests as one
101JSON bundle, the same one <code>gitbay account export</code> writes. Keys are
102never included; a replayed bundle's emails arrive unverified.</p>
103<p><a href="/settings/export">Download bundle</a></p>
104
105<h2>On SSH only</h2>
106<p class="meta">Anything whose input is a credential stays on the command line,
107where it can be piped instead of pasted:</p>
108<pre class="message">gitbay auth token mint --name laptop   # API tokens
109gitbay admin ...                       # instance administration</pre>
110<p class="meta">All of the above works from stock OpenSSH too:
111<code>ssh git@{{.Host}} auth whoami</code>.</p>
112{{end}}