Phase 10, part 4: inviting users, and what admins can change

Settings → Users lists everyone with their access and status. Admins
invite people by email (a link for 7 days), as admins or as members with
modules each to view or edit; the invitation's page sets the password,
profile and emails wanted. Admins can resend or withdraw invitations,
change access, turn accounts off and on, unlock, reset two-factor, sign
someone out, and remove them; never the owner, nor themselves. Your
account gets the emails wanted and a photo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:07:32 -07:00
co-authored by Claude Opus 5.5
parent 8040512a18
commit 47a504b7b2
18 changed files with 1220 additions and 15 deletions
+6 -3
View File
@@ -21,8 +21,10 @@ type accountData struct {
Role users.Role
Sessions []sessionRow
Zones []string
Problem string // under the form it's about
Section string // which form: profile, password, two-factor
Emails []emailKind // the emails they may choose
Photos bool // there's file storage for a photo
Problem string // under the form it's about
Section string // which form: profile, password, two-factor
// Setting up two-factor sign-in.
Secret string
@@ -76,7 +78,7 @@ func (s *Server) renderAccount(w http.ResponseWriter, r *http.Request, v *viewer
s.serverError(w, err)
return
}
d.U, d.Role, d.Zones = u, v.Member.Role, commonZones
d.U, d.Role, d.Zones, d.Emails, d.Photos = u, v.Member.Role, commonZones, emailsFor(v.Member), s.Files != nil
for _, ss := range list {
d.Sessions = append(d.Sessions, sessionRow{Session: ss, This: ss.ID == v.Session.ID})
}
@@ -95,6 +97,7 @@ func (s *Server) accountProfile(w http.ResponseWriter, r *http.Request) {
u.Name = strings.TrimSpace(r.PostFormValue("name"))
u.Title = strings.TrimSpace(r.PostFormValue("title"))
u.TimeZone = strings.TrimSpace(r.PostFormValue("time_zone"))
u.Emails = pickEmails(v.Member, r.PostForm["emails"])
switch {
case u.Name == "":
s.renderAccount(w, r, v, &accountData{Section: "profile", Problem: "Give your name."}, http.StatusUnprocessableEntity)