Sign-in & shared code
Accept invite
| Path | /accept-invite |
|---|---|
| Status | live |
| Drill-down pages | — |
| Pop-ups | — |
| Tabs | — |
| API routes | /api/auth/invite/api/auth/accept-invite |
Business rules
Data comes from: staff_invites (one row per invite link, stored as a hash, never the link itself), dh_users, dh_user_access, staff. Server: GET /api/auth/invite (who the link is for), POST /api/auth/accept-invite.
How it works:
- The link works once: it must be unused, not cancelled, not expired, and its login must still be "invited". Otherwise: "This link is not valid any more. Ask your manager to resend the invite."
- Same password rule as Reset password (6 to 200 characters, checked on the page and on the server). On success the login becomes active and is signed in straight away.
- The page removes the token from the address bar as soon as it has read it.
- Each IP may make 10 invite requests per 5 minutes (see Rate limits).
Database tables & columns
| Table | Columns used |
|---|---|
dh_user_access | access_key, position, user_id |
dh_users | access, created_at, email, failed_login_count, failed_login_window_start, id, last_login_at, locked_until, name, password_changed_at, password_hash, role, staff_id, status, updated_at |
staff | id, onboarding_completed_at |
staff_invites | expires_at, id, revoked_at, staff_id, token_hash, used_at, user_id |
File structure
Its own files
- apps/
- web/
- src/
- pages/
- AcceptInvite.tsx
- pages/
- src/
- web/
Shared code it uses (followed through its imports and the helpers its API calls; sign-in/access plumbing and UI primitives left out)
- apps/
- web/
- src/
- contexts/
- AuthContext.tsx
- services/
- api.ts
- contexts/
- src/
- worker/
- src/
- db/
- index.ts
- routes/
- auth.ts
- services/
- staff-onboarding.ts
- user-access.ts
- utils/
- jwt-key.ts
- password.ts
- db/
- src/
- web/