diff --git a/docs/architecture.md b/docs/architecture.md
index 6bc81d9..b574bf4 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -130,11 +130,13 @@ the work atomically, and the `leaderboard` table change fans out over Realtime.
- **Attendees & staff:** the **QR token is the Supabase Auth password**; the
**email is the identifier**. Login is a standard
`signInWithPassword({ email, password: qrToken })`.
-- **APPE Admin:** logs in with **email + a real password** (event-independent, so
- it works for any event). The password is recorded in `contacts.password` and
- must match the bcrypt hash in `auth.users.encrypted_password`. It is set
- directly in Supabase (no self-service UI). Staff can also open the admin app
- with their email + QR token, since that is their Auth password.
+- **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
+ Supabase Table Editor makes it work with `signInWithPassword` immediately.
+ 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
diff --git a/docs/backend/rpcs.md b/docs/backend/rpcs.md
index 5b3404f..1392240 100644
--- a/docs/backend/rpcs.md
+++ b/docs/backend/rpcs.md
@@ -43,7 +43,10 @@ The single place points change. In one transaction it:
### `_sync_leaderboard(p_event_id, p_contact_email)`
Upserts the `leaderboard` row for that (event, contact) from `registrations` +
`contacts` (`on conflict (event_id, contact_email) do update ...`). This is what
-makes the leaderboard a consistent, Realtime-friendly mirror.
+makes the leaderboard a consistent, Realtime-friendly mirror. **Staff are
+excluded:** if the contact's registration `type` is `staff` (or there is no
+registration), the function **deletes** any existing leaderboard row instead of
+inserting — so staff never appear on the board even if they hold points.
### `_recalc_event_aggregates(p_event_id)`
Recomputes the `events` aggregate columns (`num_sessions`, `num_speakers`,
@@ -54,7 +57,7 @@ triggers and the feedback RPC.
| Function | Returns | Used for |
|---|---|---|
-| `get_leaderboard()` | `event_id, contact_email, full_name, points` (active event, ordered by points) | Leaderboard initial load + realtime re-fetch |
+| `get_leaderboard()` | `event_id, contact_email, full_name, points` (active event, **staff excluded**, ordered by points) | Leaderboard initial load + realtime re-fetch |
| `lanyard_lookup(p_qr_token)` | `email, full_name, linkedin_url` (null unless `show_linkedin`), `show_email`, `registration_type` | Resolve a scanned QR (pre-login + connect) |
| `get_public_contacts()` | `email, full_name, linkedin_url`, `show_email`, `registration_type` (active-event registrants) | Connections name/type lookups |
| `get_agenda()` | flat rows: slot fields + session fields + `speakers` (string_agg) | Agenda + Home |
diff --git a/docs/backend/schema.md b/docs/backend/schema.md
index 9b19858..82e034f 100644
--- a/docs/backend/schema.md
+++ b/docs/backend/schema.md
@@ -56,7 +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) |
+| `password` | `text` | nullable — the **login password** (event-independent) for admin/staff. Setting it (e.g. in the Supabase Table Editor) **auto-syncs** the bcrypt hash into `auth.users.encrypted_password` via the `trg_contact_password_sync` trigger, so it works with `signInWithPassword` immediately |
| `external_id` | `text` | nullable — the Pretix order code (set by the sync) |
| `created_at` | `timestamptz` | |
@@ -247,6 +247,10 @@ truth — it is kept in sync transactionally by the RPCs (see
this table to update the leaderboard live. See
[../frontend/screens.md#leaderboard](../frontend/screens.md#leaderboard).
+> **Staff are excluded.** `_sync_leaderboard` skips (and removes) staff rows, so
+> staff never appear on the board even if they hold points. `get_leaderboard()`
+> also filters `type = 'staff'` as defense in depth.
+
## `points_log` — audit trail
Powers the per-category points breakdown on the Profile screen (per event).
diff --git a/docs/backend/seed.md b/docs/backend/seed.md
index 115ad4d..8feb63c 100644
--- a/docs/backend/seed.md
+++ b/docs/backend/seed.md
@@ -15,7 +15,7 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
| `slots` | 6 | 23 Oct, 09:00–15:45 (see table below) |
| `sessions` | 18 | 3 per slot (Main Stage / Room A / Room B) |
| `session_speakers` | 22 | M:N session → contact |
-| `leaderboard` | 13 | mirrored from `registrations` |
+| `leaderboard` | 10 | mirrored from `registrations`, **staff excluded** (13 registrants − 3 staff) |
| `points_log` | 16 | Ana's coherent breakdown + one `admin` entry per other user |
| Ana's demo state | — | 6 preferences, 2 check-ins, 4 connections, 1 feedback |
@@ -43,10 +43,12 @@ Source of truth: [`supabase/seed.sql`](../../supabase/seed.sql). The seed runs o
## Demo accounts
**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.
+the QR token is the Auth password. The **APPE Admin** (and any staff member you
+give one) can also log in with **email + password** (event-independent, so it
+works for any event). The password lives in `contacts.password`; a trigger
+(`trg_contact_password_sync`) **auto-syncs** it as the bcrypt hash in
+`auth.users.encrypted_password`, so just set `contacts.password` in Supabase and
+it works with `signInWithPassword` immediately.
| Person | Type | Login | Email | Start pts |
|---|---|---|---|---|
diff --git a/docs/frontend/screens.md b/docs/frontend/screens.md
index 6737915..124f65b 100644
--- a/docs/frontend/screens.md
+++ b/docs/frontend/screens.md
@@ -11,7 +11,7 @@ from `useAuth()` (`contact` + `registration`).
| Login | `Login.tsx` | shown when not authenticated |
| Home | `Home.tsx` | tab (default) |
| Agenda | `Agenda.tsx` | tab |
-| Scan / Check-in | `Scan.tsx` | tab (role-aware label) |
+| Scan | `Scan.tsx` | tab (staff get an Attendee/Staff mode toggle inside) |
| Connections | `Connections.tsx` | tab |
| Profile | `Profile.tsx` | tab |
| Leaderboard | `Leaderboard.tsx` | from Home (points pill / quick action) |
@@ -45,12 +45,14 @@ The landing screen. Shows:
- **Next card** — the pick for the next slot.
- **My picks today** — shows only **2 rows** (the current slot's pick + the next
slot's pick). "tap to change" is a **hyperlink** to the Agenda.
-- **Footer type badge** — the registration-type pill is shown **only for non-
- attendee** types (Attendee is the default and is not shown at the bottom).
-- **Quick actions** — Scan & connect / Check-in, Agenda, Connections, Leaderboard.
+- **Quick actions** — Scan & connect, Agenda, Connections, Leaderboard.
- **No active event** — a graceful empty state ("No active event right now.
Check back soon!").
+> **Identical for every role.** The Home screen (and the tab bar) is the same for
+> attendees and staff — no role badge, no "Check-in" relabel. Staff keep their
+> check-in capability inside the **Scan** screen (Attendee/Staff mode toggle).
+
Data: `useEvent()` (event + agenda + clock) + `getMyPreferences()` +
`getMyCheckins(email)`. Slot status comes from `slotStatus(slot, now)`
([app-structure.md#the-event-clock](./app-structure.md#the-event-clock)).
@@ -71,8 +73,9 @@ user speaks shows a **"🎤 you"** tag; a session with material shows a **📎**
is uploaded yet, a **non-dismissible** "📎 Upload your session material" notice
with a file input. Uploading stores the file in the `materials` bucket and
calls `set_session_material` (via `uploadSessionMaterial`). Once uploaded, the
- notice is gone and a **📎 Download material** link appears (visible to **all**
- attendees).
+ notice is gone and a **📎 Download material** button appears (visible to **all**
+ attendees), pinned to the **bottom** of the sheet's button stack (below
+ "Pick this session").
- Picking is "one per slot" — picking a new session in a slot replaces the old
pick (enforced by the `set_preference` RPC).
@@ -81,9 +84,10 @@ Data: `useEvent()` + `getMyPreferences()` + `getMyCheckins(email)` +
## Scan / Check-in
-One screen, two modes (segmented control: **Attendee / Staff**). The default mode
-and the tab label are role-aware: staff (`contact.is_admin`) default to **Staff**
-mode and the tab reads **Check-in**.
+One screen, two modes (segmented control: **Attendee / Staff**). The tab label is
+always **"Scan"** (the home page is identical for every role); the **default mode**
+is role-aware — staff (`contact.is_admin`) default to **Staff** mode, attendees to
+**Attendee** mode.
- **Attendee mode (connect):** scan a peer's lanyard → `lanyardLookup` → a
"Connect with {name}?" sheet (with the peer's registration-type badge + LinkedIn
@@ -136,6 +140,8 @@ Data: `useEvent()` (session/slot) + `submitFeedback`.
The live leaderboard.
- **Podium** for the top 3 (1st/2nd/3rd bars), then the rest as ranked rows.
+- **Staff are excluded** — only attendees appear (enforced in
+ `get_leaderboard()` / `_sync_leaderboard`).
- **Your row is highlighted** (`me`).
- **Live:** subscribes to Realtime `postgres_changes` on the `leaderboard` table
and re-fetches on any change — so it updates the moment points change anywhere.
@@ -154,8 +160,9 @@ event). The `leaderboard` table is kept in sync transactionally by the RPCs —
## Profile
-- **Header** — avatar, name, email, registration-type pill, a **staff** pill when
- `contact.is_admin`, and a points pill.
+- **Header** — avatar, name, email, registration-type pill, a **staff** pill
+ (only when `contact.is_admin` **and** the type isn't already `staff`, so it
+ never shows twice), and a points pill.
- **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."
diff --git a/docs/next-steps.md b/docs/next-steps.md
index 927d7e6..696d5de 100644
--- a/docs/next-steps.md
+++ b/docs/next-steps.md
@@ -4,12 +4,15 @@ What's done, what's next, and the open decisions. The full roadmap lives in the
root [`roadmap.md`](../roadmap.md); this file is the working detail for the
current phase.
-> **Current state:** Phases 0–8 are complete and verified, plus two polish
+> **Current state:** Phases 0–8 are complete and verified, plus three polish
> rounds: **Fixes & Refinements** (QR token moved to the registration, role-pill
> capitalization, connection detail sheet + red-dot recalc, admin schedule
-> speaker multi-select + upload/speaker bug fixes, sponsor contact search) and
+> speaker multi-select + upload/speaker bug fixes, sponsor contact search),
> **Admin password + profile self-service** (admin logs in with email + password;
-> attendees set LinkedIn + visibility on their Profile).
+> attendees set LinkedIn + visibility on their Profile), and **Staff exclusions
+> + password sync** (setting `contacts.password` auto-syncs the Auth password;
+> staff excluded from the leaderboard; Home/Agenda/Profile identical for all
+> roles).
> Remaining work is cross-cutting (real event clock, deployment, testing) and
> the open questions in [backend/interfaces.md](./backend/interfaces.md).
@@ -269,6 +272,38 @@ browser-verified.
`show_linkedin` is off and omits the email when `show_email` is off, so the
toggles actually control what other attendees see.
+## Staff exclusions + password sync — ✅ complete
+
+Migration `20260828000000_staff_exclusions_password_sync.sql` + app changes, all
+browser-verified.
+
+**Setting `contacts.password` now works for login.**
+- A trigger (`trg_contact_password_sync`) re-hashes `contacts.password` into
+ `auth.users.encrypted_password` whenever it's set/changed, so entering a
+ password on the contact row in the Supabase Table Editor makes it work with
+ `signInWithPassword` immediately (previously the two had to be kept in sync
+ by hand). A one-time reconciliation in the migration synced any already-set
+ passwords.
+- This is how a staff member (e.g. Bruno) can be given a password and log in.
+
+**Staff are excluded from the leaderboard.**
+- `_sync_leaderboard` skips (and removes) staff rows, so staff never appear on
+ the board even if they hold points. `get_leaderboard()` also filters
+ `type = 'staff'` (defense in depth), and the seed no longer inserts staff.
+- Affects the attendee Leaderboard **and** the admin Dashboard "Top points".
+
+**Home / Agenda / Profile are identical for every role.**
+- Home: the quick-action tile is always **"Scan & connect"** (was
+ "Check-in" for staff) and the footer role badge is removed. The tab bar label
+ is always **"Scan"** (was "Check-in" for staff).
+- Staff keep their check-in capability **inside the Scan screen** (the
+ Attendee/Staff mode toggle), so the home page stays role-agnostic.
+- Profile: the duplicate **Staff** pill is gone (the registration-type pill
+ already shows "Staff" for staff; the extra `is_admin` pill only shows for
+ admins whose type isn't staff).
+- Agenda session sheet: **"Download material"** moved to the **bottom** of the
+ button stack (below "Pick this session") with proper spacing.
+
## Cross-cutting / later
- **Real event clock** — replace the simulated `DEFAULT_NOW`
diff --git a/supabase/migrations/20260828000000_staff_exclusions_password_sync.sql b/supabase/migrations/20260828000000_staff_exclusions_password_sync.sql
new file mode 100644
index 0000000..4363a94
--- /dev/null
+++ b/supabase/migrations/20260828000000_staff_exclusions_password_sync.sql
@@ -0,0 +1,108 @@
+-- =============================================================================
+-- Convivo — Staff exclusions + contact-password → auth sync
+--
+-- 1. `contacts.password` now drives the Auth password. Setting it (e.g. from the
+-- Supabase Table Editor) re-hashes it into `auth.users.encrypted_password`,
+-- so an admin/staff member can log in with that password. This is what makes
+-- "set the password on the contact row in Supabase" actually work for login.
+--
+-- 2. Staff are excluded from the leaderboard (the "top points" board). They can
+-- still hold points on their registration, but they never appear on the
+-- public leaderboard or the admin Dashboard's "Top points".
+-- =============================================================================
+
+-- -----------------------------------------------------------------------------
+-- 1. CONTACT PASSWORD → AUTH PASSWORD SYNC
+-- -----------------------------------------------------------------------------
+-- When `contacts.password` is set/changed, re-hash it as the Auth password so
+-- the value works with `signInWithPassword`. Security-definer (owner postgres)
+-- so it can write `auth.users`. pgcrypto lives in the `extensions` schema.
+create or replace function public._sync_contact_password()
+returns trigger
+language plpgsql security definer set search_path = public as $$
+begin
+ if new.password is not null then
+ update auth.users
+ set encrypted_password = extensions.crypt(new.password, extensions.gen_salt('bf'))
+ where email = new.email;
+ end if;
+ return new;
+end;
+$$;
+
+drop trigger if exists trg_contact_password_sync on public.contacts;
+create trigger trg_contact_password_sync
+after update of password on public.contacts
+for each row
+when (new.password is distinct from old.password and new.password is not null)
+execute function public._sync_contact_password();
+
+comment on column public.contacts.password is
+ 'Admin/staff login password (event-independent). Setting this value re-hashes '
+ 'it into auth.users.encrypted_password (see trg_contact_password_sync), so it '
+ 'works with signInWithPassword. Set it directly in Supabase.';
+
+-- One-time reconciliation: any contact that already has a password set (e.g.
+-- entered in the Supabase Table Editor before this migration) gets it synced
+-- into auth.users now, so it works immediately.
+update auth.users u
+set encrypted_password = extensions.crypt(c.password, extensions.gen_salt('bf'))
+from public.contacts c
+where u.email = c.email
+ and c.password is not null;
+
+-- -----------------------------------------------------------------------------
+-- 2. LEADERBOARD — EXCLUDE STAFF
+-- -----------------------------------------------------------------------------
+-- `_sync_leaderboard` is the single writer of the leaderboard mirror. Make it
+-- skip staff (and remove any existing staff row), so staff never appear on the
+-- board even if they earn points.
+create or replace function public._sync_leaderboard(p_event_id uuid, p_contact_email text) returns void
+language plpgsql security definer set search_path = public as $$
+declare
+ v_type text;
+begin
+ select r.type into v_type
+ from public.registrations r
+ where r.contact_email = p_contact_email and r.event_id = p_event_id;
+
+ -- Staff (or no registration) are excluded from the leaderboard.
+ if v_type is null or v_type = 'staff' then
+ delete from public.leaderboard
+ where event_id = p_event_id and contact_email = p_contact_email;
+ return;
+ end if;
+
+ insert into public.leaderboard (event_id, contact_email, full_name, points)
+ select p_event_id, c.email, c.full_name, r.points
+ from public.contacts c
+ join public.registrations r on r.contact_email = c.email and r.event_id = p_event_id
+ where c.email = p_contact_email
+ on conflict (event_id, contact_email) do update
+ set full_name = excluded.full_name,
+ points = excluded.points,
+ updated_at = now();
+end;
+$$;
+
+-- Defense in depth: the read function also filters staff, so the board is
+-- correct even if a stray staff row exists in the table.
+create or replace function public.get_leaderboard()
+returns table (event_id uuid, contact_email text, full_name text, points integer)
+language sql stable security definer set search_path = public as $$
+ select l.event_id, l.contact_email, l.full_name, l.points
+ from public.leaderboard l
+ join public.events e on e.id = l.event_id
+ left join public.registrations r
+ on r.contact_email = l.contact_email and r.event_id = l.event_id
+ where e.is_active
+ and coalesce(r.type, 'attendee') <> 'staff'
+ order by l.points desc, l.full_name asc;
+$$;
+
+-- One-time cleanup: remove any staff rows already in the leaderboard.
+delete from public.leaderboard l
+using public.registrations r
+where r.event_id = l.event_id
+ and r.contact_email = l.contact_email
+ and r.type = 'staff';
diff --git a/supabase/seed.sql b/supabase/seed.sql
index 3a1b38b..d0d5587 100644
--- a/supabase/seed.sql
+++ b/supabase/seed.sql
@@ -213,10 +213,12 @@ on conflict (event_id, contact_email, session_id) do nothing;
-- -----------------------------------------------------------------------------
-- LEADERBOARD (mirror of registration points, per event)
-- -----------------------------------------------------------------------------
+-- Staff are excluded from the leaderboard (they don't compete for top points).
insert into public.leaderboard (event_id, contact_email, full_name, points)
select r.event_id, r.contact_email, c.full_name, r.points
from public.registrations r
join public.contacts c on c.email = r.contact_email
+where r.type <> 'staff'
on conflict (event_id, contact_email) do update
set full_name = excluded.full_name, points = excluded.points, updated_at = now();