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
+6
View File
@@ -138,6 +138,9 @@ app.use('/api/v2/webhooks', webhooksRouter);
// The church's other products (2.4.0): the event feed, event.changed and Connect
// (/api/feed/v1, /api/links/v1; src/links/routes.ts). Its own parsers (raw for the webhook).
app.use('/api', require('./links/routes').crossProductRouter());
// 3.0.0: signing in through the church's Accounts (/api/auth/*, Accounts' calls at
// /api/accounts/v1/events; src/accounts/signin.ts). Its own parsers (raw for Accounts' calls).
app.use('/api', require('./accounts/signin').accountsRouter(require('./middleware/authMiddleware').protect));
// Apply JSON body parser for all non-webhook routes
app.use(express.json());
@@ -146,6 +149,9 @@ app.use((req, res, next) => {
if (req.body === undefined) req.body = {};
next();
});
// 3.0.0: once sign-in goes through Accounts, Events' own sign-in, password and 2FA endpoints say
// where to go instead, and profile changes go to Accounts (src/accounts/guard.ts).
app.use((req, res, next) => { require('./accounts/guard').signInGuard(req, res, next).catch(next); });
// Count server errors (any 5xx response) for the Hub heartbeat.
app.use((req, res, next) => {