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
@@ -72240,6 +72240,950 @@
}
}
}
},
"/auth/mode": {
"get": {
"tags": [
"Accounts"
],
"summary": "Where people sign in",
"description": "`accounts`: send people to `GET /api/auth/signin?returnTo=<this page>` (the church's Accounts). `local`: Cross Events' own sign-in.\n\n**Who:** Anyone.",
"operationId": "getAuthMode",
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"local",
"accounts"
]
},
"signInUrl": {
"type": "string"
},
"accountUrl": {
"description": "With `accounts`: the church account page (profile, password, two-step sign-in, privacy)",
"type": [
"string",
"null"
]
}
},
"required": [
"mode",
"signInUrl",
"accountUrl"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
}
}
}
},
"/settings/sign-in": {
"get": {
"tags": [
"Accounts"
],
"summary": "Sign-in: where it is and the move to Accounts",
"description": "**Who:** Admins only.",
"operationId": "getSettingsSign-in",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"local",
"accounts"
],
"description": "local: Cross Events' own sign-in; accounts: through the church's Accounts"
},
"accountsConnected": {
"type": "boolean"
},
"accountsUrl": {
"type": [
"string",
"null"
]
},
"movedAt": {
"type": [
"string",
"null"
]
},
"undoUntil": {
"description": "Undo is possible until then (14 days after the move)",
"type": [
"string",
"null"
]
},
"secretsCleared": {
"type": "boolean",
"description": "The old passwords have been removed (Undo is no longer possible)"
},
"running": {
"type": "boolean"
},
"report": {
"anyOf": [
{},
{
"type": "null"
}
]
}
},
"required": [
"mode",
"accountsConnected",
"accountsUrl",
"movedAt",
"undoUntil",
"secretsCleared",
"running",
"report"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/settings/sign-in/check": {
"post": {
"tags": [
"Accounts"
],
"summary": "Check the move to Accounts (nothing changes)",
"description": "Who would move, who already has an account (they're linked to it), who is skipped (guests, deleted) and anything that would stop the move.\n\n**Who:** Admins only.",
"operationId": "postSettingsSign-inCheck",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"accountsVersion": {
"type": "string"
},
"toMove": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"wouldCreate": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"wouldLink": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
}
},
"required": [
"name",
"email"
],
"additionalProperties": false
}
},
"refused": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"name",
"email",
"reason"
],
"additionalProperties": false
}
},
"skipped": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"admins": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"name",
"email",
"id"
],
"additionalProperties": false
}
},
"noticeConflict": {
"anyOf": [
{
"type": "object",
"properties": {
"accountsVersions": {
"type": "array",
"items": {
"type": "number"
}
},
"eventsVersions": {
"type": "array",
"items": {
"type": "number"
}
}
},
"required": [
"accountsVersions",
"eventsVersions"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"withTwoFactor": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"accountsVersion",
"toMove",
"wouldCreate",
"wouldLink",
"refused",
"skipped",
"admins",
"noticeConflict",
"withTwoFactor"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/settings/sign-in/move": {
"post": {
"tags": [
"Accounts"
],
"summary": "Move sign-in to Accounts",
"description": "Copies everyone into the church's Accounts with their passwords and authenticator apps, checks the count, then switches. Nothing switches if anything fails, and it can be run again. Undo for 14 days.\n\n**Who:** Admins only.",
"operationId": "postSettingsSign-inMove",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"adminIds": {
"maxItems": 500,
"type": "array",
"items": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"description": "Events admins who also become Accounts admins"
},
"keepAccountsNotices": {
"description": "When Accounts has its own privacy notice: keep it (everyone accepts it at their next sign-in) instead of Events'",
"type": "boolean"
}
},
"required": [
"adminIds"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"local",
"accounts"
],
"description": "local: Cross Events' own sign-in; accounts: through the church's Accounts"
},
"accountsConnected": {
"type": "boolean"
},
"accountsUrl": {
"type": [
"string",
"null"
]
},
"movedAt": {
"type": [
"string",
"null"
]
},
"undoUntil": {
"description": "Undo is possible until then (14 days after the move)",
"type": [
"string",
"null"
]
},
"secretsCleared": {
"type": "boolean",
"description": "The old passwords have been removed (Undo is no longer possible)"
},
"running": {
"type": "boolean"
},
"report": {
"anyOf": [
{},
{
"type": "null"
}
]
}
},
"required": [
"mode",
"accountsConnected",
"accountsUrl",
"movedAt",
"undoUntil",
"secretsCleared",
"running",
"report"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"400": {
"description": "Validation failed (VALIDATION_FAILED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/settings/sign-in/undo": {
"post": {
"tags": [
"Accounts"
],
"summary": "Undo the move (back to Cross Events' own sign-in)",
"description": "Within 14 days of the move. People sign in with the password they had at the move; changes made in Accounts since then don't come back here.\n\n**Who:** Admins only.",
"operationId": "postSettingsSign-inUndo",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"local",
"accounts"
],
"description": "local: Cross Events' own sign-in; accounts: through the church's Accounts"
},
"accountsConnected": {
"type": "boolean"
},
"accountsUrl": {
"type": [
"string",
"null"
]
},
"movedAt": {
"type": [
"string",
"null"
]
},
"undoUntil": {
"description": "Undo is possible until then (14 days after the move)",
"type": [
"string",
"null"
]
},
"secretsCleared": {
"type": "boolean",
"description": "The old passwords have been removed (Undo is no longer possible)"
},
"running": {
"type": "boolean"
},
"report": {
"anyOf": [
{},
{
"type": "null"
}
]
}
},
"required": [
"mode",
"accountsConnected",
"accountsUrl",
"movedAt",
"undoUntil",
"secretsCleared",
"running",
"report"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/users/{id}/account/reset-two-factor": {
"post": {
"tags": [
"Accounts"
],
"summary": "Reset someone's two-step sign-in (in Accounts)",
"description": "They set it up again at their next sign-in, and are signed out everywhere.\n\n**Who:** Admins only.",
"operationId": "postUsersIdAccountReset-two-factor",
"security": [
{
"bearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The id",
"schema": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"const": true
}
},
"required": [
"ok"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"400": {
"description": "Validation failed (VALIDATION_FAILED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found (NOT_FOUND)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/users/{id}/account/unlock": {
"post": {
"tags": [
"Accounts"
],
"summary": "Unlock someone after too many wrong passwords (in Accounts)",
"description": "**Who:** Admins only.",
"operationId": "postUsersIdAccountUnlock",
"security": [
{
"bearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The id",
"schema": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"const": true
}
},
"required": [
"ok"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"400": {
"description": "Validation failed (VALIDATION_FAILED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found (NOT_FOUND)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/users/{id}/account/active": {
"post": {
"tags": [
"Accounts"
],
"summary": "Turn someone's church account off or on everywhere (in Accounts)",
"description": "Off signs them out of every product of the church. To only stop them using Cross Events, deactivate them here instead.\n\n**Who:** Admins only.",
"operationId": "postUsersIdAccountActive",
"security": [
{
"bearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The id",
"schema": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"active": {
"type": "boolean"
}
},
"required": [
"active"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"const": true
}
},
"required": [
"ok"
],
"additionalProperties": false
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
},
"400": {
"description": "Validation failed (VALIDATION_FAILED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Not signed in (UNAUTHENTICATED)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not allowed for this role (FORBIDDEN)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found (NOT_FOUND)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
},
"components": {