Skip to content

Phase 3: org & member onboarding - #17

Closed
ArneeMe wants to merge 1 commit into
claude/page-market-readiness-x35fdxfrom
claude/phase-3-onboarding
Closed

Phase 3: org & member onboarding#17
ArneeMe wants to merge 1 commit into
claude/page-market-readiness-x35fdxfrom
claude/phase-3-onboarding

Conversation

@ArneeMe

@ArneeMe ArneeMe commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Stacked on #16 (base is claude/page-market-readiness-x35fdx so the diff shows only phase 3 — retarget to main after #16 merges).

Removes the biggest adoption blocker: org creation and member linking were raw SQL in the Hasura console, and the admin empty-state told users to "ask an admin to add you" with no such feature existing.

Member management

  • New Medlemmer tab in the org admin: list members (emails resolved from Nhost auth users), add by email, remove with a confirm dialog (extra warning when removing yourself).
  • API GET/POST/DELETE /api/org/[slug]/members, guarded by the existing requireOrgMemberBySlug. A lockout guard refuses to remove the last member of an org.
  • New src/lib/server/authUsers.ts reads (never writes) auth.users via the Hasura users root field.

Password reset

  • "Glemt passord?" on the login page → /login/glemt sends Nhost's reset email → the emailed link lands on /login/reset, which exchanges the refreshToken and sets the new password (Nhost revokes all sessions; the user signs in again).

Assisted org creation

  • scripts/create-org.ts <slug> "<Name>" <admin-email> creates the org row and links the first admin (who must already have an Nhost account). Everything after that — templates, assets, form — is self-serve in the app.

Deploy notes (one-time, Nhost dashboard)

  • Add the production URL + /login/reset to Auth → Redirect URLs (ALLOWED_REDIRECT_URLS) so the reset email may redirect there.
  • The members API assumes auth.users is tracked in Hasura as users (Nhost default) and that user_organizations insert/delete root fields are tracked (its select already is).

Verification

  • Typecheck, lint, 99 tests, production build all pass.
  • The reset + members flows need a manual end-to-end pass against the live Nhost project before merging — that's why this is a draft.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB


Generated by Claude Code

The wall for adopting attester.no was entirely at provisioning — org
creation and member linking were raw SQL in the Hasura console, and the
admin empty-state told users to 'ask an admin to add you' with no such
feature existing. Now:

- Members admin page ('Medlemmer' tab): list members (emails resolved
  from Nhost auth users), add by email, remove with confirm dialog.
  API at /api/org/[slug]/members with the usual requireOrgMemberBySlug
  guard, plus a lockout guard so the last member can't be removed.
- Password reset: 'Glemt passord?' on the login page → /login/glemt
  requests Nhost's reset email → /login/reset exchanges the emailed
  refreshToken and sets the new password (all sessions revoked).
- scripts/create-org.ts: assisted org creation — creates the org row
  and links the first admin (who must already have an Nhost account).

export {} added to the two arg-style scripts so their top-level consts
don't collide in tsc's global scope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying inf319-certificate with  Cloudflare Pages  Cloudflare Pages

Latest commit: 16427d5
Status: ✅  Deploy successful!
Preview URL: https://eb1f90f7.inf319-certificate.pages.dev
Branch Preview URL: https://claude-phase-3-onboarding.inf319-certificate.pages.dev

View logs

ArneeMe commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the review-ordered stack #25#29 (members/reset/create-org landed in #29, the core & security tier). Closing.


Generated by Claude Code

@ArneeMe ArneeMe closed this Jul 12, 2026
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.

2 participants