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": [
+317
View File
@@ -7606,6 +7606,54 @@ export interface paths {
patch?: never;
trace?: never;
};
"/settings/sign-in/messaging": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Email and WhatsApp: this site's, and what Accounts can send
* @description **Who:** Admins only.
*/
get: operations["getSettingsSign-inMessaging"];
put?: never;
/**
* 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.
*
* **Who:** Admins only.
*/
post: operations["postSettingsSign-inMessaging"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/settings/sign-in/messaging/test": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* 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.
*
* **Who:** Admins only.
*/
post: operations["postSettingsSign-inMessagingTest"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/users/{id}/account/reset-two-factor": {
parameters: {
query?: never;
@@ -39892,6 +39940,12 @@ export interface operations {
eventsVersions: number[];
} | null;
withTwoFactor: number;
/** @description 3.1.0: what Accounts can send; the move needs email */
messaging: {
email: boolean;
whatsapp: boolean;
whatsappTwoFactor: number;
};
};
};
};
@@ -40044,6 +40098,269 @@ export interface operations {
};
};
};
"getSettingsSign-inMessaging": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
/** @description This site's own settings, to copy (never the password or token) */
events: {
email: {
host: string;
port: number;
secure: boolean;
user: string;
from: string;
hasPass: boolean;
} | null;
whatsapp: {
instanceId: string;
hasToken: boolean;
} | null;
};
/** @description What the church's Accounts can send (null: it can't be reached) */
accounts: {
email: {
ready: boolean;
host: string | null;
from: string | null;
};
whatsapp: {
ready: boolean;
instanceId: string | null;
};
} | null;
accountsError: string | null;
};
};
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postSettingsSign-inMessaging": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
email?: {
host: string;
port: number;
secure: boolean;
user: string;
from: string;
/** @description Blank: this site's own password */
pass?: string | null;
/**
* Format: email
* @description Where the test email goes
*/
to: string;
};
whatsapp?: {
instanceId: string;
/** @description Blank: this site's own token */
accessToken?: string | null;
/** @description The phone the test message goes to */
to: string;
};
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
email: {
ok: boolean;
error: string | null;
saved: boolean;
} | null;
whatsapp: {
ok: boolean;
error: string | null;
saved: boolean;
} | null;
status: {
email: {
ready: boolean;
host: string | null;
from: string | null;
};
whatsapp: {
ready: boolean;
instanceId: string | null;
};
};
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postSettingsSign-inMessagingTest": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
email?: {
host: string;
port: number;
secure: boolean;
user: string;
from: string;
/** @description Blank: this site's own password */
pass?: string | null;
/**
* Format: email
* @description Where the test email goes
*/
to: string;
};
whatsapp?: {
instanceId: string;
/** @description Blank: this site's own token */
accessToken?: string | null;
/** @description The phone the test message goes to */
to: string;
};
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
email: {
ok: boolean;
error: string | null;
saved: boolean;
} | null;
whatsapp: {
ok: boolean;
error: string | null;
saved: boolean;
} | null;
status: {
email: {
ready: boolean;
host: string | null;
from: string | null;
};
whatsapp: {
ready: boolean;
instanceId: string | null;
};
};
};
};
};
};
/** @description Validation failed (VALIDATION_FAILED) */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not signed in (UNAUTHENTICATED) */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
/** @description Not allowed for this role (FORBIDDEN) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
"postUsersIdAccountReset-two-factor": {
parameters: {
query?: never;