feat(mail): give free members a webmail password at join@

The gateway opens mailboxes via the Dovecot master user (no member password),
but webmail (Roundcube) needs the member to have a password. join@ now sets a
fresh, readable webmail password via the Mailu API and shows it with the webmail
URL + login, so free members can use webmail at mail.profullstack.com.

- mailu: SetPassword (PATCH /user/<email> raw_password) + test.
- main.go: setWebmailPassword + readablePassword; join@ displays url/login/password.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-23 09:57:46 +00:00
parent 1cc6a9c89e
commit 7a6e466977
3 changed files with 92 additions and 1 deletions

View file

@ -99,3 +99,26 @@ func TestEnsureUserUnconfigured(t *testing.T) {
t.Fatal("expected error when unconfigured")
}
}
func TestSetPassword(t *testing.T) {
var method, path string
var body map[string]any
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
method, path = r.Method, r.URL.Path
b, _ := io.ReadAll(r.Body)
_ = json.Unmarshal(b, &body)
w.WriteHeader(http.StatusOK)
}))
defer srv.Close()
c := New(Config{BaseURL: srv.URL, Token: "t"})
if err := c.SetPassword(context.Background(), "alice", "bbs.profullstack.com", "hunter2"); err != nil {
t.Fatal(err)
}
if method != http.MethodPatch || path != "/api/v1/user/alice@bbs.profullstack.com" {
t.Fatalf("got %s %s", method, path)
}
if body["raw_password"] != "hunter2" {
t.Fatalf("raw_password = %v", body["raw_password"])
}
}