Phase 10, part 2: the first owner, from a one-time setup link

A new server prints a link to create its owner (supermarket setup-link
makes another); until it's used, every page says the setup isn't
finished. One-time links (schema 33) are kept as hashes and used up in
one statement; resets and invitations will use them too. The server
edition opens Postgres.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 08:53:14 -07:00
co-authored by Claude Opus 5.5
parent 96404a3580
commit 72455438c9
16 changed files with 553 additions and 10 deletions
+23
View File
@@ -0,0 +1,23 @@
{{define "content"}}{{with .Data}}
{{if .Token}}
<h1>Set up Supermarket</h1>
<p class="lede">You're its owner: you can do everything, and invite the rest of the team. Then fill in the company's profile.</p>
{{if .Problems}}<div class="error" role="alert">{{range .Problems}}<p>{{.}}</p>{{end}}</div>{{end}}
<form class="card" method="post" action="/setup/{{.Token}}">
<label>Your email address <input type="email" name="email" value="{{.Email}}" autocomplete="username" required autofocus></label>
<label>Your name <input name="name" value="{{.Name}}" autocomplete="name" required></label>
<label>Choose a password <input type="password" name="password" autocomplete="new-password" minlength="10" required>
<span class="help">At least 10 characters. A few unrelated words make a good one.</span></label>
<label>The same password again <input type="password" name="password2" autocomplete="new-password" minlength="10" required></label>
<button type="submit">Create the owner</button>
</form>
{{else}}
<h1>This setup link doesn't work</h1>
<section class="card">
<p>It has expired (a setup link lasts a day), was already used, or was replaced by a newer one.</p>
<p class="help">For a new link, run this on the server, and open the address it prints:</p>
<pre>docker compose exec supermarket supermarket setup-link</pre>
<p class="help">If Supermarket is already set up, <a href="/signin">sign in</a>.</p>
</section>
{{end}}
{{end}}{{end}}