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
+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;