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:
@@ -14,6 +14,17 @@
|
||||
<script src="/static/app.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
{{if .Bare}}
|
||||
<div class="bare-shell">
|
||||
<p class="brand"><img class="logo" src="/static/logo.png" alt="" width="28" height="28">Supermarket</p>
|
||||
<main class="bare-main">
|
||||
{{if .Flash}}<p class="flash" role="status">{{.Flash}}</p>{{end}}
|
||||
{{if .Error}}<p class="error" role="alert">{{.Error}}</p>{{end}}
|
||||
{{template "content" .}}
|
||||
</main>
|
||||
<p class="version">Supermarket {{.Version}}</p>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="shell">
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<a class="brand" href="/"><img class="logo" src="/static/logo.png" alt="" width="28" height="28">Supermarket</a>
|
||||
@@ -111,6 +122,7 @@
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{{define "content"}}
|
||||
<h1>Supermarket isn't set up yet</h1>
|
||||
<section class="card">
|
||||
<p>Its owner hasn't been created. Whoever installed it opens the setup link from the start-up log, which begins <code>/setup/</code>.</p>
|
||||
<p class="help">To make a new link, run this on the server:</p>
|
||||
<pre>docker compose exec supermarket supermarket setup-link</pre>
|
||||
</section>
|
||||
{{end}}
|
||||
@@ -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}}
|
||||
Reference in New Issue
Block a user