Admin password login + attendee profile self-service
- contacts.password: admin-only APPE Admin login password (event-independent); must match the bcrypt hash in auth.users.encrypted_password (set in Supabase). - APPE Admin login is now email + password (was QR token). - update_my_profile RPC (security definer, scoped to current_email()): attendees set their LinkedIn URL + show_email / show_linkedin toggles from the Profile. - Convivo Profile gains a 'Profile settings' card (LinkedIn + 2 toggles + Save). - Visibility enforced server-side in the public projection (linkedin nulled when show_linkedin off, email omitted when show_email off). - Seed: admin password appe-admin-2026; staff keep QR tokens as auth passwords. - Docs updated (schema, rpcs, seed, admin-app, screens, api-client, architecture, next-steps, README, docker-compose). Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
2f3952dc71
commit
0221b1a8c0
19 files changed
+290
-59
No files matched your search
@@ -24,16 +24,19 @@ It runs on **port 3001** (Vite dev) or as the `convivo-admin` Docker container
|
||||
|
||||
## Auth guard
|
||||
|
||||
Login is the same QR + email flow as the attendee app
|
||||
(`signInWithPassword({ email, password: qrToken })`), but `AuthContext` checks the
|
||||
contact's `is_admin` flag after signing in:
|
||||
Login is **email + password** (`signInWithPassword({ email, password })`), but
|
||||
`AuthContext` checks the contact's `is_admin` flag after signing in:
|
||||
|
||||
- If `is_admin === true` → the session is accepted and the console is shown.
|
||||
- Otherwise → the app calls `signOut()` and shows **"This account is not an
|
||||
admin."** The same check runs on session restore (page reload) and on every
|
||||
`onAuthStateChange`, so a non-admin can never see the console.
|
||||
|
||||
The demo admin is `CVV-ADM-0001` / `[email protected]`.
|
||||
The password is **event-independent** — it is the contact's Auth password
|
||||
(`contacts.password` must match the bcrypt hash in `auth.users.encrypted_password`),
|
||||
so the same admin can log in for any event. The demo admin is
|
||||
`[email protected]` / password `appe-admin-2026`. Staff (Bruno/Rita) can also open the
|
||||
admin app using their email + QR token, since that is their Auth password.
|
||||
|
||||
## Source layout
|
||||
|
||||
@@ -52,7 +55,7 @@ apps/admin/src/
|
||||
├─ components/
|
||||
│ └─ ui.tsx # Avatar, Spinner, Empty, Modal, QrImage, TypeBadge, Toggle
|
||||
├─ screens/
|
||||
│ └─ Login.tsx # QR + email login (admin-only)
|
||||
│ └─ Login.tsx # email + password login (admin-only)
|
||||
└─ views/
|
||||
├─ Dashboard.tsx # active event + aggregates + top points + activity
|
||||
├─ Contacts.tsx # table + edit / is_admin / visibility / points
|
||||
|
||||
@@ -54,6 +54,7 @@ These map 1:1 to the Postgres RPCs documented in
|
||||
| `submitFeedback(sessionId, rating, comment)` | `submit_feedback` | Rate a session (+5/+10) |
|
||||
| `getLeaderboard()` | `get_leaderboard` | Active-event leaderboard |
|
||||
| `uploadSessionMaterial(sessionId, file)` | `set_session_material` | Upload to `materials` bucket + set `material_path` |
|
||||
| `updateMyProfile({linkedin_url, show_email, show_linkedin})` | `update_my_profile` | Self-service: set LinkedIn + visibility toggles on the caller's own contact |
|
||||
|
||||
### Direct table reads (RLS-scoped)
|
||||
|
||||
|
||||
@@ -159,8 +159,16 @@ event). The `leaderboard` table is kept in sync transactionally by the RPCs —
|
||||
- **My QR code** — renders `registration.qr_token` (the token lives on the
|
||||
registration, per event) as a scannable QR (`QrImage`). "Show this to staff for
|
||||
check-in and to peers to connect."
|
||||
- **Profile settings** — self-service card: a **LinkedIn** URL input plus two
|
||||
**visibility toggles** ("Show my email" / "Show my LinkedIn") and a **Save
|
||||
profile** button. Saving calls `update_my_profile` (the security-definer RPC,
|
||||
since the `contacts` UPDATE policy is admin-only), then `refresh()` to reload
|
||||
the contact. The toggles control what other attendees see — the public
|
||||
projection (`lanyard_lookup` / `get_public_contacts`) nulls `linkedin_url` when
|
||||
`show_linkedin` is off and omits the email when `show_email` is off.
|
||||
- **Points breakdown** — sums `points_log` by category
|
||||
(Session check-ins / Connections / Feedback / Other) + Total.
|
||||
- **Log out** — `signOut()`.
|
||||
|
||||
Data: `useAuth()` (contact + registration) + `getMyPointsLog(email)`.
|
||||
Data: `useAuth()` (contact + registration + `refresh`) + `getMyPointsLog(email)`
|
||||
+ `updateMyProfile(...)`.
|
||||
Reference in new issue
Block a user