Commit af6988e4c0

af6988e4c09c713d189b0c122d10786bf89afd85

parent: e0fcc7c7b1

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-19 04:29 UTC

web, control, e2e: name the web path after registration

The registered page and the verification mail told a newcomer only the
SSH activation command. Both now also say: sign in with the emailed
link, paste the code under Settings, then + creates a repository.

Ref #226

Layout: unified · split

e2e/registration_test.go +3
@@ -143,6 +143,9 @@ func TestOpenRegistration(t *testing.T) {
143 if !strings.Contains(msg, "To: dana@example.test") || !strings.Contains(msg, "From: noreply@gitbay.test") { 143 if !strings.Contains(msg, "To: dana@example.test") || !strings.Contains(msg, "From: noreply@gitbay.test") {
144 t.Fatalf("mail headers:\n%s", msg) 144 t.Fatalf("mail headers:\n%s", msg)
145 } 145 }
146 if !strings.Contains(msg, "/login") {
147 t.Fatalf("mail missing web sign-in path:\n%s", msg)
148 }
146 149
147 // Pending: the key authenticates, whoami works, but everything else is 150 // Pending: the key authenticates, whoami works, but everything else is
148 // gated — control commands and git alike. 151 // gated — control commands and git alike.
e2e/websignup_test.go +2 −1
@@ -54,7 +54,8 @@ func TestWebSignup(t *testing.T) {
54 // The real thing: account is active immediately (invite proves the mailbox). 54 // The real thing: account is active immediately (invite proves the mailbox).
55 status, body = browserPost(t, browser, inst.base()+"/register", url.Values{ 55 status, body = browserPost(t, browser, inst.base()+"/register", url.Values{
56 "username": {"erin"}, "invite": {inviteCode}, "key": {string(pub)}}) 56 "username": {"erin"}, "invite": {inviteCode}, "key": {string(pub)}})
57 if status != 200 || !strings.Contains(body, "welcome, erin") { 57 if status != 200 || !strings.Contains(body, "welcome, erin") ||
58 !strings.Contains(body, `href="/settings"`) || !strings.Contains(body, "paste the code") {
58 t.Fatalf("signup: %d\n%s", status, body) 59 t.Fatalf("signup: %d\n%s", status, body)
59 } 60 }
60 out, errOut, code := inst.ssh(t, key, "", "whoami") 61 out, errOut, code := inst.ssh(t, key, "", "whoami")
internal/control/register.go +2 −1
@@ -127,8 +127,9 @@ func sendVerification(cfg config.Config, st *store.Store, userID int64, address
127 body := fmt.Sprintf( 127 body := fmt.Sprintf(
128 "Someone (hopefully you) added this address to an account on %s.\n\n"+ 128 "Someone (hopefully you) added this address to an account on %s.\n\n"+
129 "To verify it, run:\n\n ssh git@%s email verify %s\n\n"+ 129 "To verify it, run:\n\n ssh git@%s email verify %s\n\n"+
130 "Or sign in at https://%s/login with this address and paste the code under Settings.\n\n"+
130 "The code expires in 24 hours. If this wasn't you, ignore this mail.\n", 131 "The code expires in 24 hours. If this wasn't you, ignore this mail.\n",
131 siteHost(cfg), siteHost(cfg), code) 132 siteHost(cfg), siteHost(cfg), code, siteHost(cfg))
132 return mail.Send(cfg, address, "verify your email on "+siteHost(cfg), body) 133 return mail.Send(cfg, address, "verify your email on "+siteHost(cfg), body)
133} 134}
134 135
internal/web/templates/registered.html +5 −1
@@ -4,7 +4,11 @@
4<div class="landing"> 4<div class="landing">
5<h1>Welcome, {{.Username}}</h1> 5<h1>Welcome, {{.Username}}</h1>
6<pre class="quickstart">{{.Message}}</pre> 6<pre class="quickstart">{{.Message}}</pre>
7<p>Everything runs over SSH with the key you registered:</p> 7<h2>On the web</h2>
8<p>Check your mail for the code, <a href="/login">sign in</a> with an emailed
9link, and paste the code under <a href="/settings">Settings</a>. Then +
10creates your first repository.</p>
11<h2>From the terminal</h2>
8<pre class="quickstart">ssh git@{{.Host}} whoami 12<pre class="quickstart">ssh git@{{.Host}} whoami
9ssh git@{{.Host}} repo create {{.Username}}/hello 13ssh git@{{.Host}} repo create {{.Username}}/hello
10gitbay web login # mints a browser session from your terminal</pre> 14gitbay web login # mints a browser session from your terminal</pre>