Events 3.1.0, Accounts 1.2.0, contracts 1.9.0: the move needs Accounts' email

A church moved sign-in to Accounts without email set up there: codes and
password links couldn't be sent, sign-in failed with a 500, nobody could
get in.

- contracts 1.9.0: messaging.status/test/set (SMTP, WAWP; secrets sealed);
  people.ensure answers emailSent.
- Accounts 1.2.0: SendError instead of a 500; WhatsApp codes fall back to
  email; forgot password says email isn't set up; setup only offers
  methods that work; messaging.* (test, save only what worked); test
  WhatsApp in admin; WAWP from .env.
- Events 3.1.0: Settings -> Sign-in shows what Accounts can send and
  copies this site's SMTP/WAWP into it (secrets stay on the server), test
  then save; Move disabled and refused (EMAIL_NOT_READY) without email.
Tests: Accounts 54, contracts 218, Events 774, test:accounts 16 (also on
Postgres).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 21:41:31 +02:00
co-authored by Claude Opus 5.5
parent 4b28fc485b
commit cc18b7b514
44 changed files with 2568 additions and 51 deletions
@@ -72554,6 +72554,29 @@
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"messaging": {
"type": "object",
"properties": {
"email": {
"type": "boolean"
},
"whatsapp": {
"type": "boolean"
},
"whatsappTwoFactor": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"email",
"whatsapp",
"whatsappTwoFactor"
],
"additionalProperties": false,
"description": "3.1.0: what Accounts can send; the move needs email"
}
},
"required": [
@@ -72565,7 +72588,8 @@
"skipped",
"admins",
"noticeConflict",
"withTwoFactor"
"withTwoFactor",
"messaging"
],
"additionalProperties": false
}
@@ -72870,6 +72894,787 @@
}
}
},
"/settings/sign-in/messaging": {
"get": {
"tags": [
"Accounts"
],
"summary": "Email and WhatsApp: this site's, and what Accounts can send",
"description": "**Who:** Admins only.",
"operationId": "getSettingsSign-inMessaging",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"events": {
"type": "object",
"properties": {
"email": {
"anyOf": [
{
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"secure": {
"type": "boolean"
},
"user": {
"type": "string"
},
"from": {
"type": "string"
},
"hasPass": {
"type": "boolean"
}
},
"required": [
"host",
"port",
"secure",
"user",
"from",
"hasPass"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"whatsapp": {
"anyOf": [
{
"type": "object",
"properties": {
"instanceId": {
"type": "string"
},
"hasToken": {
"type": "boolean"
}
},
"required": [
"instanceId",
"hasToken"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"email",
"whatsapp"
],
"additionalProperties": false,
"description": "This site's own settings, to copy (never the password or token)"
},
"accounts": {
"anyOf": [
{
"type": "object",
"properties": {
"email": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"host": {
"type": [
"string",
"null"
]
},
"from": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"host",
"from"
],
"additionalProperties": false
},
"whatsapp": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"instanceId": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"instanceId"
],
"additionalProperties": false
}
},
"required": [
"email",
"whatsapp"
],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "What the church's Accounts can send (null: it can't be reached)"
},
"accountsError": {
"type": [
"string",
"null"
]
}
},
"required": [
"events",
"accounts",
"accountsError"
],
"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"
}
}
}
}
}
},
"post": {
"tags": [
"Accounts"
],
"summary": "Save email / WhatsApp settings in Accounts (after a test)",
"description": "Accounts tests each part as /test does, and saves it only if its test worked.\n\n**Who:** Admins only.",
"operationId": "postSettingsSign-inMessaging",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "object",
"properties": {
"host": {
"type": "string",
"minLength": 1,
"maxLength": 253
},
"port": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"secure": {
"type": "boolean"
},
"user": {
"type": "string",
"maxLength": 254
},
"from": {
"type": "string",
"minLength": 3,
"maxLength": 320
},
"pass": {
"description": "Blank: this site's own password",
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"to": {
"type": "string",
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
"description": "Where the test email goes"
}
},
"required": [
"host",
"port",
"secure",
"user",
"from",
"to"
]
},
"whatsapp": {
"type": "object",
"properties": {
"instanceId": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"accessToken": {
"description": "Blank: this site's own token",
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"to": {
"type": "string",
"minLength": 8,
"maxLength": 30,
"description": "The phone the test message goes to"
}
},
"required": [
"instanceId",
"to"
]
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"email": {
"anyOf": [
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"error": {
"type": [
"string",
"null"
]
},
"saved": {
"type": "boolean"
}
},
"required": [
"ok",
"error",
"saved"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"whatsapp": {
"anyOf": [
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"error": {
"type": [
"string",
"null"
]
},
"saved": {
"type": "boolean"
}
},
"required": [
"ok",
"error",
"saved"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"status": {
"type": "object",
"properties": {
"email": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"host": {
"type": [
"string",
"null"
]
},
"from": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"host",
"from"
],
"additionalProperties": false
},
"whatsapp": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"instanceId": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"instanceId"
],
"additionalProperties": false
}
},
"required": [
"email",
"whatsapp"
],
"additionalProperties": false
}
},
"required": [
"email",
"whatsapp",
"status"
],
"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/messaging/test": {
"post": {
"tags": [
"Accounts"
],
"summary": "Test email / WhatsApp settings through Accounts (nothing saved)",
"description": "Accounts sends a test email to `email.to` and a WhatsApp message to `whatsapp.to` with the settings given. A blank password or token uses this site's own.\n\n**Who:** Admins only.",
"operationId": "postSettingsSign-inMessagingTest",
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "object",
"properties": {
"host": {
"type": "string",
"minLength": 1,
"maxLength": 253
},
"port": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"secure": {
"type": "boolean"
},
"user": {
"type": "string",
"maxLength": 254
},
"from": {
"type": "string",
"minLength": 3,
"maxLength": 320
},
"pass": {
"description": "Blank: this site's own password",
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"to": {
"type": "string",
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
"description": "Where the test email goes"
}
},
"required": [
"host",
"port",
"secure",
"user",
"from",
"to"
]
},
"whatsapp": {
"type": "object",
"properties": {
"instanceId": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"accessToken": {
"description": "Blank: this site's own token",
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"to": {
"type": "string",
"minLength": 8,
"maxLength": 30,
"description": "The phone the test message goes to"
}
},
"required": [
"instanceId",
"to"
]
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"email": {
"anyOf": [
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"error": {
"type": [
"string",
"null"
]
},
"saved": {
"type": "boolean"
}
},
"required": [
"ok",
"error",
"saved"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"whatsapp": {
"anyOf": [
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"error": {
"type": [
"string",
"null"
]
},
"saved": {
"type": "boolean"
}
},
"required": [
"ok",
"error",
"saved"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"status": {
"type": "object",
"properties": {
"email": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"host": {
"type": [
"string",
"null"
]
},
"from": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"host",
"from"
],
"additionalProperties": false
},
"whatsapp": {
"type": "object",
"properties": {
"ready": {
"type": "boolean"
},
"instanceId": {
"type": [
"string",
"null"
]
}
},
"required": [
"ready",
"instanceId"
],
"additionalProperties": false
}
},
"required": [
"email",
"whatsapp"
],
"additionalProperties": false
}
},
"required": [
"email",
"whatsapp",
"status"
],
"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"
}
}
}
}
}
}
},
"/users/{id}/account/reset-two-factor": {
"post": {
"tags": [