tag claim flow: scanned code auto-fills Add Tag field (?code=), unclaimed tag page shows 'Add this tag to my account' when logged in, login honors next= so code survives the login step

This commit is contained in:
2026-08-10 17:04:21 +10:00
parent 04fd5ac63a
commit 1fae314eb4
5 changed files with 24 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
<div class="mt-4 rounded-xl border border-stone-200 bg-white p-4 shadow-sm">
<form hx-post="/account/tags" hx-target="#account-panel" hx-swap="outerHTML" class="flex gap-2">
<input name="tag_code" type="text" placeholder="Enter tag code (e.g. TEST000001)" class="flex-1 rounded border border-stone-300 px-3 py-2 text-sm" required>
<input name="tag_code" type="text" value="{{.AddTagCode}}" placeholder="Enter tag code (e.g. TEST000001)" class="flex-1 rounded border border-stone-300 px-3 py-2 text-sm" required autofocus>
<button type="submit" class="rounded bg-stone-900 px-4 py-2 text-sm font-semibold text-white hover:bg-stone-700">Add tag</button>
<span class="htmx-indicator self-center text-xs text-stone-400">Adding…</span>
</form>

View File

@@ -6,8 +6,12 @@
<h1 class="mt-4 text-2xl font-bold">This tag isn't set up yet</h1>
<p class="mt-2 text-stone-600">This Where Woof tag hasn't been claimed. If this is your tag, log in and add it to your account to set up the return details.</p>
<div class="mt-6 flex justify-center gap-3">
<a href="/login" class="rounded bg-stone-900 px-4 py-2 text-sm font-semibold text-white hover:bg-stone-700">Log in</a>
{{if .Data.Authed}}
<a href="/account?code={{.Data.TagCode}}" class="rounded bg-stone-900 px-4 py-2 text-sm font-semibold text-white hover:bg-stone-700"> Add this tag to my account</a>
{{else}}
<a href="/login?next=/account?code={{.Data.TagCode}}" class="rounded bg-stone-900 px-4 py-2 text-sm font-semibold text-white hover:bg-stone-700">Log in</a>
<a href="/register" class="rounded bg-amber-500 px-4 py-2 text-sm font-semibold text-stone-900 hover:bg-amber-400">Create account</a>
{{end}}
</div>
</div>
{{else if eq .Data.Status "suspended"}}