Skip to content

v2: household settings page + native setup-account flow#1111

Merged
canalesb93 merged 2 commits into
mainfrom
v2-household-settings
May 16, 2026
Merged

v2: household settings page + native setup-account flow#1111
canalesb93 merged 2 commits into
mainfrom
v2-household-settings

Conversation

@canalesb93
Copy link
Copy Markdown
Owner

Summary

  • Adds a Household section to the v2 settings modal: lists family members, lets the admin invite each one with a role (viewer / editor / admin), and surfaces a one-time setup link to share.
  • Replaces the legacy /setup-account/<token> admin form with a v2-native setup page at /v2/setup-account/<token>. Greets the new member by email, takes their password, and signs them straight into /v2/. Pre-auth JSON endpoints under /web/v1/setup-account/{token} back it.
  • Moves the "Add member" primary out of the settings-dialog header (it was overlapping the dialog's close X) into the section body.

Legacy /setup-account/<token> admin route stays mounted so previously-issued tokens keep working.

Screens

Household section — desktop / tablet / mobile

Household section across breakpoints

Setup-account page — what a new member sees on the share link

Setup-account page — set your password

Flow

  1. Admin opens Settings → Household → Add member, fills name + email, ticks Invite them to sign in, picks role.
  2. Backend creates the user, creates the login, returns a setup_token. SPA shows a copy-able link to /v2/setup-account/<token>.
  3. Member opens the link (no auth needed). SPA hits GET /web/v1/setup-account/<token> → renders form, or SETUP_TOKEN_INVALID / ALREADY_SETUP cards.
  4. Member submits password → POST /web/v1/setup-account/<token> hashes + stores it, clears the token, opens a session, returns {account_id, username, role}. SPA navigates to /v2/.

Test plan

  • bun run lint (tsc --noEmit) clean
  • bun run build (vite production build) clean
  • go build ./... clean
  • Add a member without a login → row shows "no login" badge
  • Add a member with a login invite → share-link dialog appears with the /v2/setup-account/<token> URL
  • Open setup link in an incognito tab → form renders with the right email, password validation works, success signs into /v2/
  • Bad/expired token → "This setup link is invalid" card
  • Already-set-up token → "Already set up" card with "Go to sign in"
  • Delete-member confirmation refuses when the user still has bank connections (server-side; surfaces via toast)
  • Smoke against make build && ./breadbox serve (embedded SPA path) one more time before merge

🤖 Generated with Claude Code

canalesb93 and others added 2 commits May 15, 2026 23:46
Add a Household section to the v2 settings modal that lists family members
and lets the admin invite them to sign in. Mirrors the v1 admin flow:
create a member (name + optional email), optionally create a login, get a
one-time setup URL to share, copy to clipboard.

- types.ts: LoginAccount + LoginAccountRole
- queries/users.ts: create/update/delete user, list/create/regenerate/delete
  login mutations, plus setupAccountURL helper
- features/settings/household-section.tsx: member list, add-member dialog,
  per-member kebab menu (invite, reset password, remove login, delete member),
  share-link dialog with copy button, delete confirmation

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Setup links now point at /v2/setup-account/<token> instead of the v1 admin
form. New page greets the member by email, takes a password + confirm,
sets it via POST /web/v1/setup-account/<token>, and opens a session so the
SPA navigates straight into /v2/. Three branches handled: valid token →
form, invalid/expired → SETUP_TOKEN_INVALID card, already setup → bounce
to /login.

Also moves the Add Member primary button out of the settings dialog header
(it was overlapping the close X) into the section body below the
description.

- web/embed.go: SetupAccountInfoHandler (GET) + SetupAccountHandler (POST)
- internal/api/router.go: mount both pre-auth under /web/v1
- web/src/api/queries/auth.ts: useSetupAccountInfo / useSetupAccount
- web/src/routes/setup-account.tsx: the new page
- web/src/routes/__root.tsx: exempt /setup-account/* from the auth gate
- web/src/main.tsx: register the route
- web/src/features/settings/household-section.tsx: move the primary action
- web/src/api/queries/users.ts: setupAccountURL → /v2/setup-account/<token>

Legacy /setup-account/<token> remains mounted so tokens already in the
wild keep working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@canalesb93 canalesb93 force-pushed the v2-household-settings branch from 00359aa to 2ac699d Compare May 16, 2026 06:46
@canalesb93 canalesb93 enabled auto-merge (squash) May 16, 2026 06:46
@canalesb93 canalesb93 merged commit 67b5f96 into main May 16, 2026
9 of 10 checks passed
@canalesb93 canalesb93 deleted the v2-household-settings branch May 16, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant