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:
1 parent
b52d8ab007
commit
8b1130f078
19 files changed
+290
-59
No files matched your search
@@ -175,6 +175,20 @@ session** (the `sessions` table is admin-write only, so speakers need this
|
||||
security-definer RPC to attach their uploaded material). The attendee app calls
|
||||
this after uploading a file to the `materials` bucket.
|
||||
|
||||
### `update_my_profile(p_linkedin_url, p_show_email, p_show_linkedin)` → `contacts`
|
||||
**Self-service (any authenticated attendee).** Lets a contact edit their own
|
||||
profile from the Convivo app: the LinkedIn URL and the two visibility toggles
|
||||
(`show_email` / `show_linkedin`).
|
||||
- Scoped to `current_email()` — a user can only ever update **their own** row.
|
||||
- `linkedin_url` is trimmed; an empty/blank value is stored as `NULL`.
|
||||
- The toggles default to `false` when `NULL` is passed.
|
||||
- **Why an RPC?** The `contacts` RLS `UPDATE` policy is **admin-only**
|
||||
(`contacts_admin_update`), so an attendee cannot update their own row directly
|
||||
through PostgREST. This `security definer` function (owner `postgres`) bypasses
|
||||
that, but is deliberately limited to the three self-service columns — it cannot
|
||||
touch `is_admin`, `password`, `external_id`, etc.
|
||||
- Returns the updated contact row.
|
||||
|
||||
## Interface sync RPCs (service-role-only)
|
||||
|
||||
Two additional `security definer` RPCs import external data. They are **not**
|
||||
|
||||
@@ -56,6 +56,7 @@ password).
|
||||
| `show_email` | `boolean` | default `false` — visibility toggle |
|
||||
| `show_linkedin` | `boolean` | default `false` — visibility toggle |
|
||||
| `is_admin` | `boolean` | default `false` — **staff = admin (merged)**; grants check-in + APPE Admin access |
|
||||
| `password` | `text` | nullable — **admin-only**: the APPE Admin login password (event-independent). To work it must match the bcrypt hash in `auth.users.encrypted_password`. Set directly in Supabase (no self-service UI) |
|
||||
| `external_id` | `text` | nullable — the Pretix order code (set by the sync) |
|
||||
| `created_at` | `timestamptz` | |
|
||||
|
||||
|
||||
+15
-9
@@ -7,7 +7,7 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
|
||||
|
||||
| Data | Count | Notes |
|
||||
|---|---|---|
|
||||
| `auth.users` + `auth.identities` | 13 | 12 attendees + 1 admin; **QR token = bcrypt password** |
|
||||
| `auth.users` + `auth.identities` | 13 | 12 attendees + 1 admin; **QR token = bcrypt password** (attendees/staff) — the admin uses a real **password** instead |
|
||||
| `contacts` | 14 | 13 registrants + 1 external keynote speaker (no token — tokens live on registrations) |
|
||||
| `events` | 1 | **APPE 2026**, 2026-10-23, São Paulo, Brazil, **active** |
|
||||
| `registrations` | 13 | one per contact (Elena has none); points + **QR token** scoped here |
|
||||
@@ -42,14 +42,18 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
|
||||
|
||||
## Demo accounts
|
||||
|
||||
Login = **QR code** (typed or scanned) + **email**. The QR token is the password.
|
||||
**Attendees & staff** log in with **QR code** (typed or scanned) + **email** —
|
||||
the QR token is the Auth password. The **APPE Admin** is different: it logs in
|
||||
with **email + password** (event-independent, so it works for any event). The
|
||||
admin's password is stored in `contacts.password` **and** as the bcrypt hash in
|
||||
`auth.users.encrypted_password` (they must match). Set it directly in Supabase.
|
||||
|
||||
| Person | Type | QR code | Email | Start pts |
|
||||
| Person | Type | Login | Email | Start pts |
|
||||
|---|---|---|---|---|
|
||||
| **Ana Silva** | attendee | `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
|
||||
| **Bruno Costa** | staff (admin) | `CVV-BRU-1177` | bruno.costa@acme.com | 140 |
|
||||
| **Rita Lopes** | staff (admin) | `CVV-RIT-9034` | rita.lopes@globant.com | 95 |
|
||||
| **APPE Admin** | staff (admin) | `CVV-ADM-0001` | admin@appe.at | 0 |
|
||||
| **Ana Silva** | attendee | QR `CVV-ANA-4821` | ana.silva@nubank.com | 40 |
|
||||
| **Bruno Costa** | staff (admin) | QR `CVV-BRU-1177` | bruno.costa@acme.com | 140 |
|
||||
| **Rita Lopes** | staff (admin) | QR `CVV-RIT-9034` | rita.lopes@globant.com | 95 |
|
||||
| **APPE Admin** | staff (admin) | **password** `appe-admin-2026` | admin@appe.at | 0 |
|
||||
| Tomás Ribeiro | attendee | `CVV-TOM-5566` | tomas.ribeiro@dataprev.com | 88 |
|
||||
| Sofia Almeida | attendee | `CVV-SOF-2299` | sofia.almeida@loop.com | 76 |
|
||||
| Marco Chen | attendee | `CVV-MRC-7712` | marco.chen@deepmind.com | 70 |
|
||||
@@ -98,5 +102,7 @@ Ana (`[email protected]`) is seeded with a coherent 40-point history:
|
||||
3. Log in as **Bruno** (staff) → the Scan tab becomes **Check-in** → pick a
|
||||
session → scan **Carla** (`CVV-CAR-6623`) → she gets +10.
|
||||
4. Watch the **Leaderboard** update live (Realtime).
|
||||
5. Log in as **APPE Admin** (`CVV-ADM-0001` / `[email protected]`) in the admin app
|
||||
→ Dashboard, Contacts, Registrations, Sponsors, Schedule, Activity, Events.
|
||||
5. Log in as **APPE Admin** (`[email protected]` / password `appe-admin-2026`) in the
|
||||
admin app → Dashboard, Contacts, Registrations, Sponsors, Schedule, Activity,
|
||||
Events. (Staff Bruno/Rita can also open the admin app with their email + QR
|
||||
token, since that is their Auth password.)
|
||||
Reference in new issue
Block a user