Foundations
User accounts, password resets and role management that you control
Account handling is the least glamorous part of a website and the fastest way to lose a customer. If a password reset email does not arrive, the visitor does not open a support ticket, they leave.
GoGee builds on a managed authentication service rather than hand-rolling credentials, then adds the part that actually differs per client: who holds which role, and what that role can reach.
GoGee feature series · 33 of 33
How it's actually built
- Authentication
- Managed auth service with email and password plus Google sign-in
- Password reset
- Emailed reset link, then an in-app set-new-password screen
- Sessions
- Token-based sessions refreshed by the client library
- Profiles
- Separate profile row per user for display details
- Roles
- Stored in a dedicated user-roles table, never on the profile
- Enforcement
- Security-definer role helper used inside row-level security policies
- 01Input
Sign-up or sign-in
Email and password, or Google
- 02Deterministic
Managed auth
Sessions and reset links handled by the auth service
- 03Database
Profile row
Display details separate from credentials
- 04Database
User roles table
Unique user-and-role pairs, never on the profile
- 05Output
Enforced access
Row-level security via security-definer helper
Guardrails and fallbacks
- Roles never stored on an editable profile row
- Reset requires the emailed link
Password reset & user management, data flow, generated from the shared GoGee feature diagram template.
Sign-up, sign-in and reset
Visitors register with email and password or sign in with Google. A forgotten-password request sends a reset link to the account's email address; following it returns the user to a set-new-password screen in the app and signs them in on success.
Email confirmation behaviour is a project decision rather than a default we impose, because a trade portal and a consumer store want different answers.
- Email and password plus Google sign-in
- Emailed reset link with an in-app new-password step
- Sessions refreshed automatically by the client library
- Sign-out clears the session everywhere in the app
Roles live in their own table, deliberately
Roles are never stored on the profile record. They live in a dedicated user-roles table with a unique pairing of user and role, read through a security-definer helper function that row-level security policies call.
The reason is a specific class of vulnerability: if a role sits on a row the user can update, the user can promote themselves. Separating the table removes that possibility structurally rather than relying on careful policy writing.
What an administrator can do
Administrators assign and remove roles, which is what determines access to admin areas, branch scoping and trade pricing. Trade or business accounts can be approved from a pending state before they see account pricing.
Being precise about the boundary: role assignment and approval are in the admin. Deeper account administration such as suspending users or reassigning their history is built per project when a client needs it, not something we claim as standard.
Why managed auth rather than our own
Credential storage, token refresh, social provider flows and reset-link expiry are all places where a bespoke implementation is quietly worse than a maintained one. We use a managed service and spend the effort on authorisation instead, which is where client-specific risk actually lives.
The practical benefit is that a new admin screen inherits the same boundary as every existing one, because the check happens in the database.
Questions we get asked
How does a customer reset a forgotten password?
They request a reset from the sign-in screen, receive an email link, and set a new password in the app.
Can a user give themselves admin access?
No. Roles are held in a separate table read by a security-definer function used inside row-level security policies, not on an editable profile row.
Can we sign in with Google?
Yes, Google sign-in is supported alongside email and password.
Read next
Security
Role-based access control
GoGee stores roles in a dedicated table and checks them with security-definer functions inside row-level secur…
Platform
Member sections & client logins
GoGee's member area gives each customer their own orders, invoices, vouchers, addresses, saved baskets and bus…
Infrastructure
Edge-fast everywhere
GoGee sites run on Cloudflare Workers with smart placement and a Supabase Postgres backend, so requests are se…

