Cross Events 3.0.0: sign-in through the church's Accounts

Settings -> Sign-in: check, move (everyone into Accounts with their password
hashes and authenticator apps, count/hash check, then switch) and undo for
14 days. Sign-in through auth-client with a one-time handoff to Events' own
token; staff roles stepped up to mfa; sign-out and back-channel logout;
user.updated/export/deleted; admin 2FA reset, unlock and profile changes via
Accounts; /login, /register, /forgot-password forward once moved; Events'
own sign-in endpoints answer SIGN_IN_MOVED. User.accountId, AccountsSignIn.

npm run test:accounts runs Events' code against the real Accounts app (11
tests); 5 new Jest tests. MIGRATING-TO-3.md, plan "Changes while building".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 14:10:30 +02:00
co-authored by Claude Opus 5.5
parent 56cbef1d9b
commit c627c61de1
49 changed files with 4094 additions and 245 deletions
+51
View File
@@ -5,6 +5,57 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project follows [Semantic Versioning](https://semver.org/).
## [3.0.0] - unreleased
Sign-in through the church's Accounts (ROADMAP-v3 phase 4, docs/EVENTS-3.0-PLAN.md). Requires
Accounts 1.1.0 (`— requires accounts 1.1.0` in WHATS-NEW.md) and contracts 1.8.0. Nothing changes
for people until an admin moves sign-in; see MIGRATING-TO-3.md.
### Added
- **Settings → Sign-in** (`/api/v2/settings/sign-in`, `…/check`, `…/move`, `…/undo`): Check (a dry
run in Accounts: who moves, who is linked to an account they already have, who is refused or
skipped), Move and Undo (14 days). The move sends everyone with a real email address to Accounts
(`crosscode.identity-request/1`, batches of 200, password hashes and authenticator secrets sealed
with the link's secret), checks Accounts holds the same people (count and hash of the subs), and
only then switches `auth_mode` to `accounts`. A move that fails switches nothing and can be run
again. The admin who ran it gets the report by email; it's in the audit log.
- **Signing in through Accounts** (`src/accounts/`): `GET /api/auth/signin?returnTo=` (PKCE, the
state carries the page), `GET /api/auth/callback` (finds the user by `accountId`, links a guest or
unlinked user with the same verified email, or makes a new `user`; keeps Events' copy of the
profile, news consent and 2FA method), then `/auth/complete#<one-time code>`, which the page swaps
for Events' own token at `POST /api/auth/handoff` (60 seconds, single use). Staff roles that need
2FA are sent straight back with `acr_values=mfa` when Accounts didn't ask for it. The token carries
`asi` (the sign-in) and `mfa`, which `protect` checks for staff roles; tokens from before the move
keep working under the old rules.
- **Signing out** (`POST /api/auth/signout`) ends Events' sessions and sends the browser to Accounts'
sign-out, which signs out of every product; **back-channel logout** from Accounts
(`/api/auth/backchannel-logout`) ends that person's Events sessions.
- **Accounts' calls** at `/api/accounts/v1/events`: `user.updated` (the local copy), `user.export`
(Events' export as sections), `user.deleted` (anonymise, or `deferred` while there's a registration
for an event that hasn't ended).
- **Admin, through Accounts:** `/api/v2/users/:id/account/reset-two-factor`, `…/unlock`, `…/active`;
changing someone's name, email or phone (`PATCH /users/:id`) changes their account first. People
staff add (ticket transfers, registrations at the door) get their account from Accounts
(`people.ensure`, a "choose your password" email) instead of an Events activation link.
- `GET /api/v2/auth/mode` (public): `local` or `accounts`, and the church account page.
- `User.accountId` (decision 1), `AccountsSignIn`, six audit actions; the `accounts-secrets` job
clears Events' passwords, authenticator secrets, recovery codes and trusted devices 14 days after
the move, and sign-in records after 40 days.
- `npm run test:accounts` (backend): Events' sign-in and move against the real Accounts app.
### Changed
- With sign-in through Accounts: `/login`, `/register` and `/forgot-password` forward there (every
`/login?redirect=` link keeps working); old reset and activation links say sign-in has moved; Events'
own sign-in, password, 2FA and close-account endpoints answer `409 SIGN_IN_MOVED`; Profile shows the
details read-only and links to the church account for password, 2FA and closing the account; the
privacy centre links there for news, "download my data" and deletion. An unsubscribe link or a
WhatsApp STOP turns news off in Accounts too (`people.newsOff`).
- `useRequireAuth` sends people to `/login?redirect=<this page>`, so they come back to it.
- The inactive-account retention rule skips people linked to Accounts (Accounts keeps or removes
them).
## [2.4.1] - 2026-11-19
### Fixed