Commit a5a27ecbe6
Verified · cmc
Layout: unified · split
internal/httpd/accounts_test.go added +27
| @@ -0,0 +1,27 @@ | |||
| 1 | package httpd | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "strings" | ||
| 5 | "testing" | ||
| 6 | |||
| 7 | "gitbay.org/gitbay/internal/web" | ||
| 8 | ) | ||
| 9 | |||
| 10 | // The registered page's web steps are a numbered list, and mention where | ||
| 11 | // the iOS app gets a token, so a new user is not left guessing (#264). | ||
| 12 | func TestRegisteredPageNumberedStepsAndTokenMention(t *testing.T) { | ||
| 13 | var sb strings.Builder | ||
| 14 | if err := web.Render(&sb, "registered.html", struct { | ||
| 15 | basePage | ||
| 16 | Username, Message, Host string | ||
| 17 | }{Username: "alice", Host: "gitbay.org"}); err != nil { | ||
| 18 | t.Fatalf("render: %v", err) | ||
| 19 | } | ||
| 20 | out := sb.String() | ||
| 21 | if !strings.Contains(out, "<ol>") { | ||
| 22 | t.Error("next steps are not a numbered list") | ||
| 23 | } | ||
| 24 | if !strings.Contains(out, "Settings → Tokens") { | ||
| 25 | t.Error("no mention of Settings → Tokens for the iOS app") | ||
| 26 | } | ||
| 27 | } | ||
internal/web/templates/registered.html +7 −3
| @@ -5,9 +5,13 @@ | |||
| 5 | <h1>Welcome, {{.Username}}</h1> | 5 | <h1>Welcome, {{.Username}}</h1> |
| 6 | <pre class="quickstart" tabindex="0">{{.Message}}</pre> | 6 | <pre class="quickstart" tabindex="0">{{.Message}}</pre> |
| 7 | <h2>On the web</h2> | 7 | <h2>On the web</h2> |
| 8 | <p>Check your mail for the code, <a href="/login">sign in</a> with an emailed | 8 | <ol> |
| 9 | link, and paste the code under <a href="/settings">Settings</a>. Then + | 9 | <li>Copy the verification code from the mail you were just sent.</li> |
| 10 | creates your first repository.</p> | 10 | <li><a href="/login">Sign in</a> with an emailed link.</li> |
| 11 | <li>Paste the code in <a href="/settings#emails">Settings → Email</a>.</li> | ||
| 12 | </ol> | ||
| 13 | <p>Then + creates your first repository. Using the iOS app? Create a | ||
| 14 | token in <a href="/settings#tokens">Settings → Tokens</a>.</p> | ||
| 11 | <h2>From the terminal</h2> | 15 | <h2>From the terminal</h2> |
| 12 | <pre class="quickstart" tabindex="0">ssh git@{{.Host}} whoami | 16 | <pre class="quickstart" tabindex="0">ssh git@{{.Host}} whoami |
| 13 | ssh git@{{.Host}} repo create {{.Username}}/hello | 17 | ssh git@{{.Host}} repo create {{.Username}}/hello |