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).
This commit is contained in:
Lago committed 2026-08-23 14:11:26 +02:00
1 parent b52d8ab007
commit 8b1130f078
19 files changed
+290 -59

No files matched your search

+8 -5
View File
@@ -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