Convivo login: staff QR asks for staff password (not email)

When a staff QR is detected, the confirm step now shows a password field
instead of the email field. Login uses the resolved contact's email + the
entered staff password (signInWithPassword). Attendees are unchanged (QR +
ticket email). Docs updated (screens.md, architecture.md).
This commit is contained in:
Lago committed 2026-08-23 19:18:59 +02:00
1 parent 698bf13551
commit 1bffae9777
3 files changed
+81 -32

No files matched your search

+9 -8
View File
@@ -127,16 +127,17 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
## 6. Authentication model
- **Attendees & staff:** the **QR token is the Supabase Auth password**; the
**email is the identifier**. Login is a standard
- **Attendees:** the **QR token is the Supabase Auth password**; the **email is
the identifier**. Login is a standard
`signInWithPassword({ email, password: qrToken })`.
- **APPE Admin / staff:** can log in with **email + a real password**
(event-independent, so it works for any event). The password is recorded in
`contacts.password`; a trigger (`trg_contact_password_sync`) **auto-syncs** it
as the bcrypt hash in `auth.users.encrypted_password`, so setting it in the
- **Staff:** log in with **QR + their admin password** (event-independent). In
the Convivo app, scanning a staff QR shows a **password** field (not the email
field); the email is taken from the resolved contact. The password is recorded
in `contacts.password`; a trigger (`trg_contact_password_sync`) **auto-syncs**
it as the bcrypt hash in `auth.users.encrypted_password`, so setting it in the
Supabase Table Editor makes it work with `signInWithPassword` immediately.
Staff can also still log in with their email + QR token (their seeded Auth
password).
(Staff can also still log in with their email + QR token, their seeded Auth
password.)
- `enable_confirmations = false`, so **no email is sent** — the email is only a
"confirm it's you" check against the ticket purchase.
- After login, the app holds a **session JWT** (in `localStorage`) that lasts
+13 -5
View File
@@ -25,12 +25,20 @@ A 3-step flow: **splash → scan → confirm**.
2. **Scan** — scan (or type) your lanyard QR. Calls `lanyardLookup(qrToken)` to
resolve the contact (pre-login, public). Shows the resolved name + registration
type badge.
3. **Confirm** — enter the **email used to buy the ticket**, then
`signInWithPassword({ email, password: qrToken })`. On success the
`AuthContext` updates and the Shell renders the app. On mismatch, an error is
shown ("Email and QR code do not match").
3. **Confirm** — the field depends on the resolved role:
- **Staff** (`registration_type === 'staff'`) — enter the **staff password**.
Login is `signInWithPassword({ email: <resolved contact email>, password })`.
(The email is taken from the resolved contact, so staff only type their
password.)
- **Everyone else** — enter the **email used to buy the ticket**, then
`signInWithPassword({ email, password: qrToken })` (the QR token is the auth
password).
> This is the QR + email login — no email is ever sent. See
On success the `AuthContext` updates and the Shell renders the app. On
mismatch, an error is shown ("Email and QR code do not match" for attendees,
"That password is incorrect" for staff).
> No email is ever sent. See
> [../architecture.md#6-authentication-model](../architecture.md#6-authentication-model)
> and [../backend/rls.md](../backend/rls.md).