bugfix: the flow for trial and accept invitation (org + staff)is now unified. all navigate to dshboard if succesfull.
This commit is contained in:
16
.cursor/rules/post-auth-navigation.mdc
Normal file
16
.cursor/rules/post-auth-navigation.mdc
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
description: Post-auth enter-app routing — login, register, invites, share-link redirect
|
||||
globs: frontend/src/lib/auth/postAuthRedirect.ts,frontend/src/lib/hooks/useEnterAppWhenAuthenticated.ts,frontend/src/lib/hooks/useAuth.tsx,frontend/src/app/**/login/page.tsx,frontend/src/app/**/register/page.tsx,frontend/src/app/**/accept-invite/page.tsx,frontend/src/app/**/accept-organization-invite/page.tsx,frontend/src/app/**/forgot-password/page.tsx,frontend/src/app/**/(dashboard)/layout.tsx
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Post-auth navigation
|
||||
|
||||
`login()` / `registerTrial()` select the only org (or push `/select-organization`). They do **not** go to `/today`.
|
||||
|
||||
- **Login + register:** `useEnterAppWhenAuthenticated` after org ready → `appPathAfterAuth()` (`consumeAuthRedirect()` once, else `/today`).
|
||||
- **Login `?from=`:** `storeAuthRedirectFromPath` **before** that hook (effect order).
|
||||
- **Staff / org invite:** accept → `login(email, password)` → `navigateIntoAppIfOrgSelected`. ❌ Do not put the hook on invite pages (logged-in visitors must finish accept).
|
||||
- **Forgot password:** navigates itself to `/settings/account?reset=1`. ❌ Do not add the enter-app hook there.
|
||||
- **Multi-org:** redirect stays in sessionStorage until `selectOrganization()` → `appPathAfterAuth()`.
|
||||
- ❌ Never `consumeAuthRedirect()` inside `useAuth.login()` or `registerTrial`.
|
||||
Reference in New Issue
Block a user