Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Identify accounts by their registered name

62576fa8157d431dcf2d360f3ebe481de77bda03 · Keenan Nemetz · 14d ago · parent 642e5994

Identify accounts by their registered name

Drop the internal account id and display name. Users, keys, passkeys,
invites, sessions, ACL entries, approvals, locks and CI records now all
use the registered name as the single identity.

The roster migrates in place: old id-keyed tables are rebuilt around the
name, and access-rule/lock references are rewritten through the same
mapping. Display-name editing and whoami --id are removed.

server/web/account.go +4−31

@@ -5,33 +5,6 @@ import (
5 5 "strings"
6 6 )
7 7
8 // SetAccountDisplay changes the signed-in account's display label. This is the
9 // one profile field a person owns: the account name is fixed at creation because
10 // refs and metadata files were written with it, but the label nobody is
11 // authorized by can be anything they like.
12 func (w *Web) SetAccountDisplay(rw http.ResponseWriter, r *http.Request) {
13 pr, ok := w.requireHTMLUser(rw, r)
14 if !ok {
15 return
16 }
17 r.Body = http.MaxBytesReader(rw, r.Body, 16<<10)
18 if !w.checkCSRF(r) {
19 http.Error(rw, "bad request", http.StatusForbidden)
20 return
21 }
22 if err := r.ParseForm(); err != nil {
23 http.Error(rw, "cannot read the form", http.StatusBadRequest)
24 return
25 }
26 display := strings.TrimSpace(r.PostFormValue("display"))
27 if _, err := w.Ident.SetDisplay(pr.account.ID, display, pr.account.Name); err != nil {
28 http.Error(rw, err.Error(), http.StatusBadRequest)
29 return
30 }
31 w.audit("web.display", pr.account.ID, display)
32 http.Redirect(rw, r, "/account", http.StatusSeeOther)
33 }
34
35 8 // AddAccountKey lets a signed-in person attach an SSH public key without an
36 9 // administrator. Open registration is only useful for Git contributions if the
37 10 // account can turn its browser session into a key that pushes.
@@ -54,7 +27,7 @@ func (w *Web) AddAccountKey(rw http.ResponseWriter, r *http.Request) {
54 27 http.Error(rw, "paste an SSH public key", http.StatusBadRequest)
55 28 return
56 29 }
57 fp, err := w.Ident.AddKey(pr.account.ID, key, pr.account.Name)
30 fp, err := w.Ident.AddKey(pr.account.Name, key, pr.account.Name)
58 31 if err != nil {
59 32 msg := err.Error()
60 33 if strings.Contains(msg, "already registered") {
@@ -64,7 +37,7 @@ func (w *Web) AddAccountKey(rw http.ResponseWriter, r *http.Request) {
64 37 http.Error(rw, msg, http.StatusBadRequest)
65 38 return
66 39 }
67 w.audit("web.key.add", pr.account.ID, fp)
40 w.audit("web.key.add", pr.account.Name, fp)
68 41 http.Redirect(rw, r, "/account", http.StatusSeeOther)
69 42 }
70 43
@@ -89,10 +62,10 @@ func (w *Web) RemoveAccountKey(rw http.ResponseWriter, r *http.Request) {
89 62 http.Error(rw, "choose a key", http.StatusBadRequest)
90 63 return
91 64 }
92 if err := w.Ident.RemoveKey(pr.account.ID, fp, pr.account.Name); err != nil {
65 if err := w.Ident.RemoveKey(pr.account.Name, fp, pr.account.Name); err != nil {
93 66 http.Error(rw, err.Error(), http.StatusBadRequest)
94 67 return
95 68 }
96 w.audit("web.key.remove", pr.account.ID, fp)
69 w.audit("web.key.remove", pr.account.Name, fp)
97 70 http.Redirect(rw, r, "/account", http.StatusSeeOther)
98 71 }