fix(GRO-2011): /login renders blank — always fetch /api/setup/status #35
Closed
Flea Flicker
wants to merge 2 commits from
gro-1867-portal-better-auth into dev
pull from: gro-1867-portal-better-auth
merge into: groombook:dev
groombook:main
groombook:gro-2381-agents-contributing
groombook:uat
groombook:flea/uat-to-main-gro-2359-web
groombook:promote/GRO-2373-dev-to-uat
groombook:dev
groombook:feature/gro-2373-chrome-signout
groombook:promote/GRO-2358-dev-to-uat
groombook:release/main-GRO-2319-web
groombook:promote/GRO-2319-web-to-uat
groombook:feat/GRO-2319-live-statusbadge-palette
groombook:flea/uat-to-main-gro-2160
groombook:promote/GRO-2160-dev-to-uat
groombook:flea/uat-to-main-gro-2159
groombook:promote/GRO-2159-dev-to-uat
groombook:feat/GRO-2159-route-drag-reorder
groombook:flea/uat-to-main-gro-2158
groombook:flea/dev-to-uat-gro-2158
groombook:feat/GRO-2158-route-planner
groombook:flea/dev-to-uat-gro-2236
groombook:flea/gro-2236-portal-service-cards
groombook:flea/uat-to-main-gro-2234-web
groombook:flea/promote-uat-gro-2234
groombook:flea-flicker/gro-2234-portal-waitlist-remint-on-401
groombook:fix/gro-2207-portal-pet-readview-fields
groombook:flea/gro-2218-playbook-512e
groombook:flea/gro-2213-portal-preferredtime
groombook:flea/gro-2180-appointments-starttime-shape
groombook:fix/gro-2094-react-blank-mount
groombook:flea/gro-2099-fix-authed-portal-nav
groombook:flea/gro-2089-fix-authentik-credential-source
groombook:flea/gro-2012-portal-sessionid-fallback
groombook:flea/gro-2011-login-blank
groombook:gro-1829-swpwa-fix
groombook:ccfa5281-2076-40c2-87a9-bf2dbcf98d22/gro-1822-role-based-redirect
groombook:fix/gro-1822-role-based-redirect
groombook:feature/gro-1165e-booking-status-badge
groombook:feature/gro-1165d-booking-analytics
groombook:feature/gro-1165b-error-recovery
groombook:flea-flicker/pet-profile-editor
groombook:fix/gro-1757-uat-playbook
groombook:fix/gro-1633-web-ci-buildx
groombook:promote-uat-gro1592
groombook:fix/gro-1592-sso-session-cookie
groombook:pr-13
groombook:fix/gro-1414-pet-size-enum
groombook:pr-1
groombook:fix/ci-registry-auth
groombook:fix/GRO-1289-uat-playbook-web
groombook:add-renovate-config
groombook:docs/GRO-1099-uat-playbook-web
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3297903d5c |
fix(GRO-2011): always fetch /api/setup/status, even for unauth users
The second useEffect in App skipped the setup/status fetch when `!authDisabled && !session` was true. In the deployed bundle the `needsSetup` state therefore stayed `null` for unauth users, and a later render short-circuit rendered nothing — producing the blank white viewport at https://uat.groombook.dev/login. Drop the unauth skip clause so `/api/setup/status` is always fetched as soon as the auth state is known. The unauth branch in the render is handled before `needsSetup` is consulted, so this is safe and removes the stuck-`null` state. Adds: - New unit test in src/__tests__/App.test.tsx asserting the unauthenticated path calls /api/setup/status. - UAT playbook entry TC-WEB-5.1.5 covering the blank-viewport regression scenario. Co-Authored-By: Paperclip <noreply@paperclip.ing> |
||
|
|
775fb1594c |
GRO-1867: bridge Better Auth session to CustomerPortal
Adds a third initialisation path to src/portal/CustomerPortal.tsx so real
customers authenticated via Authentik SSO can reach /portal without being
bounced back to /login.
After the existing impersonation (?sessionId=) and dev-mode (localStorage
dev-user) paths, the portal now:
1. Calls GET /api/auth/get-session (credentials: include) to detect an
active Better Auth session.
2. If the user is a non-staff customer, POSTs /api/portal/session-from-auth
(the endpoint shipped by GRO-1866) to mint a portal session.
3. Stores the returned sessionId in portalSessionId state and threads it
through renderSection -> sections so all /api/portal/* calls include
the X-Impersonation-Session-Id header.
4. On 404 (no client row), renders a friendly "Portal access not
configured" card with a Sign out button instead of looping back to
/login. On 401/network error, falls through to the existing /login
redirect guard.
The bridge skips when impersonation or dev-user is active and when the
Better Auth user is staff (App.tsx already routes staff to /admin). The
impersonation banner remains gated on session?.status === "active", so the
SSO-bridged session does not show staff chrome.
Tests:
- 4 new vitest cases in src/__tests__/portal.test.tsx cover the success,
404 fallback, missing-Better-Auth-session, and staff-role paths.
- pnpm vitest run src/__tests__/portal.test.tsx -> 18 passed
- pnpm typecheck -> clean
UAT_PLAYBOOK.md: adds §5.25 (TC-WEB-5.25.1 - TC-WEB-5.25.11) covering the
new flow end-to-end on UAT.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
|