Files
crosscode-platform/apps/accounts/CHANGELOG.md
T
joshuaandClaude Opus 5.5 405b5f1b92 Accounts 1.6.0: a "New sign-in" email (and WhatsApp) after every sign-in
As Cross Events' own sign-in sends: when, the site, rough location and device, with what to do if
it wasn't them. WhatsApp too for a verified number. Admins can turn it off (signin_notices).
Fire-and-forget: never holds up or fails a sign-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:54:03 +02:00

192 lines
11 KiB
Markdown

# Changelog — Accounts
## [1.6.0] - 2026-11-20
### Added
- **"New sign-in" notices**, as Cross Events' own sign-in sends (`src/accounts/signInNotice.ts`):
after each completed sign-in (the interaction reaching done, so not the silent ones a second
product gets from an existing session), an email with when, the site, rough location and device
(`newSignInEmail` in `src/lib/emails.ts`), and a WhatsApp message when the person has a verified
number and WhatsApp is set up. Location from ip-api.com in production only, never for private
addresses. Fire-and-forget: never holds up or fails a sign-in. Admins can turn it off:
`signin_notices` (Sign-in settings, on by default). In Accounts mode Cross Events no longer sends
its own, so before this nobody was told.
## [1.5.0] - 2026-11-20
Needs contracts 1.14.0.
### Added
- `people.check` (contracts 1.14.0): for up to 500 subs, the current profile of each person the
product knows (`active` / `deactivated`), `deleted` for a deleted account, `unknown` for anyone
else (no profile). Audited once per request (`people_checked_by_product`, counts only); the reply
isn't stored for retries, since it holds profiles. Cross Events 3.6.0 asks nightly.
## [1.4.0] - 2026-11-20
Works with every Cross Events 3.x and contracts 1.11.0 or later.
### Added
- **Admin → Background jobs**, as Cross Events': each job's schedule, next run and last runs,
"Run now", and a switch and schedule per job. The choice is saved in the database
(`job_overrides`), wins over the .env and applies straight away (other processes within 30 s).
New optional .env flags per job, as Events: `EXPORTS_JOB_ENABLED`, `DELETIONS_JOB_ENABLED`,
`BACKUP_ENABLED`, `HUB_HEARTBEAT_ENABLED`, and `JOB_SCHEDULE_<NAME>`. API: `GET /api/v2/admin/jobs`,
`PUT /api/v2/admin/jobs/:name` `{ enabled, cron }`, `POST /api/v2/admin/jobs/:name/run`.
On timers (when the queue can't start) jobs now follow their cron schedule too.
### Changed
- **Every email is styled as Cross Events'** (`src/lib/emails.ts`): a header in the church's
colour with its logo or name, a button for the link (written out underneath), callouts for
warnings, and the church's contact details in the footer. Sign-in codes, password reset, "your
account at …", confirm a new email address, "your email address changed", "your data is ready"
and the test emails. The plain text is sent too and hasn't changed. Everything put in the HTML is
escaped, and only http(s) links are used.
## [1.3.0] - 2026-11-20
Needs contracts 1.11.0 (`people.removeDemo`). Works with every Cross Events 3.x.
### Added
- **Backups** (Admin → Backups, `src/backups/backups.ts`): a gzipped `pg_dump` every night at
02:00 (job `backup`) and on "Back up now", into `backend/backups/` with the names the
`crosscode` script already gives its pre-deploy dumps (`accounts-YYYYMMDD-HHMMSS.sql.gz`), so
both show in one list. Keeps the newest 14 by default (`backup_retain_count`), nightly can be
turned off (`backup_nightly`), downloads are admin-only and audited, a failed dump leaves no file
and shows why (`backup_last_error`). The heartbeat's `lastBackupAt` is the newest backup.
Needs `pg_dump` (the PostgreSQL client) on the server, as the crosscode script does.
- **Quick links to the church's sites** on the account page (`GET /api/v2/me/apps`): each
connected product; Events opens its dashboard through its own sign-in (no second sign-in).
- `people.removeDemo` (contracts 1.11.0): a product's old demo people (`@example.com`, known
through that product, not admins) are signed out everywhere and anonymised; the reply says which
were kept and why.
- A favicon (`app/icon.svg`), the same for every church.
### Changed
- **The account and admin pages look like Cross Events' dashboard:** the church's logo and name in
a top bar, a sidebar with the person, their role and the sections, panels with icon tiles, and a
dark footer. Each section has its own address: `/account` (overview), `/account/details`,
`/security`, `/privacy`, `/activity`; `/admin` (people), `/admin/deletions`, `/church`,
`/linked`, `/signin`, `/messages`, `/notice`, `/backups`, `/licence`, `/audit`. The
"your data is ready" email's link (`/account/privacy`) now opens the right section. Sign-in pages
keep their centred card.
- **The built-in privacy notice** is rewritten in sections, as Cross Events' policy: what's kept,
how it's used, who sees it (the church's sites, admins, email and WhatsApp providers, aggregate
totals to Cross Code), where and how long (including backups), cookies, POPIA rights, children,
changes and contact. A line starting "## " is a heading and "• " a bullet, on the privacy page,
the sign-in step and the admin's preview. Churches still on the built-in notice see the new text
as version 1 (it describes the same practice more fully); Admin → Privacy notice can start a new
version from it, which asks everyone to read it again.
### Fixed
- `backend/.gitignore` ignores `/backups/` (the dumps the crosscode script makes).
## [1.2.0] - 2026-11-19
Found after a church moved Cross Events' sign-in here without email set up in Accounts: every
sign-in that needed an emailed code failed with a 500, and nobody could get in.
### Fixed
- **A code that can't be sent no longer fails the sign-in (500).** The page says the church's email
isn't working and to tell the office (`CODE_NOT_SENT`, 503). A WhatsApp sign-in code that can't go
is sent by email instead (as Cross Events); setting WhatsApp up still needs WhatsApp to work.
- **Forgot password** says plainly that email isn't set up (`EMAIL_NOT_READY`, the same for every
address) instead of failing.
- Setting up two-step sign-in only offers email when email works (an app always does).
- `people.ensure` makes the account even when its "choose your password" email can't go, and tells
the product (`emailSent: false`).
### Changed
- **The sign-in pages look like the church's other sites:** a wash of the church's colour, its logo
and name across the top (its first letter on its colour while there's no logo), the form in a card
edged in that colour with an icon per step, and a footer (`@crosscode/ui` Shell, Card, Heading,
ChurchMark; the account and admin pages get the same frame).
- **The church's logo and colours come from Cross Events:** a move fills the logo, colours and name
Accounts doesn't have yet (`import.begin` now carries the logo and accent colour), and
`church.branding` (contracts 1.9.0) replaces them when an admin asks.
### Added
- **`messaging.*` requests** (contracts 1.9.0) for a linked product's sign-in settings: `status`
(what can be sent, no secrets), `test` (sends a test email / WhatsApp with the settings given,
saves nothing) and `set` (tests, then saves each part only if its test worked). The SMTP password
and WAWP token come sealed with the link's secret, are stored encrypted, and `null` keeps the saved one.
- Admin → Email and WhatsApp: **Send a test WhatsApp** (to the admin's own phone), next to the test email.
- WAWP from the server's `.env` (`WAWP_ACCESS_TOKEN`, `WAWP_INSTANCE_ID`) when the database has
none, as Cross Events and as SMTP already did.
## [1.1.0] - 2026-11-19
For Cross Events 3.0 (docs/EVENTS-3.0-PLAN.md §8), with contracts 1.8.0.
### Added
- **`POST /api/accounts/v1/requests`** (`crosscode.identity-request/1`), signed with the link's
secret: what a linked product asks of Accounts. A request id seen before gets its first answer.
- **Moving a product's users in** (`import.begin` / `batch` / `finish` / `abort`, Cross Events
only): each person keeps their Events id as their `sub`, their bcrypt or Argon2id password hash,
2FA method and authenticator secret (sealed with the link's secret on the way, encrypted with
Accounts' key at rest), lockout, news consent and its history, notice acceptance, last sign-in
and status; ticked Events admins become Accounts admins. An email that already has an account is
**linked** (that account and its password stay). A check (`check: true`) writes nothing.
`import.finish` checks every sub the product relies on is an account here, not deleted, and
known to that product, and lists the ones that aren't. Events' privacy notice versions are
taken when Accounts has published none; an empty church name and colour are filled from Events.
- **New recovery codes after the first sign-in** for people moved in with 2FA (their Events codes
can't move): shown once after the second step, whatever step comes next.
- **`people.*`**: `ensure` (find or make an account; a new one gets a "choose your password" email
whose link ends on the product), `update`, `resetTwoFactor`, `unlock`, `setActive`, `newsOff`.
Only for people the product knows (moved in, added, or signed in through it), never an Accounts
admin's 2FA or status, and audited with the product and the product admin's `sub`.
- **`screen=signup`** on an authorization request opens the sign-in page on "Create an account"
(`startSignIn(…, { signUp: true })` in `@crosscode/auth-client`).
### Changed
- Setting a password from an emailed link also confirms the email address.
## [1.0.1] - 2026-11-19
### Fixed
- **`TRUST_PROXY=loopback` turned proxy trust off.** Accounts read `TRUST_PROXY` as true/false, so
anything but `true`, including the `loopback` the Hub suggests behind frp, meant off: rate
limiting and the audit log saw every visitor as `127.0.0.1`, and oidc-provider ignored
`X-Forwarded-Proto`. It's now read as Events reads it: `loopback`, a hop count, proxy IP
addresses/CIDRs separated by commas, or `true`/`false` in any case (`true` is one hop, as
before). Unset is still one hop in production.
## [1.0.0] - 2026-11-18
The first release (docs/ACCOUNTS-1.0-PLAN.md), with Hub 2.3.0 and agent 1.1.0. Released before the
VM test and a run on real Postgres; do both before installing it for a church.
### Added
- OpenID Connect provider (oidc-provider 9.13.3): authorization code with PKCE (S256) required,
ES256 keys made on first start, `crosscode.identity/1` claims in the ID token, no refresh tokens,
RP-initiated logout and OIDC Back-Channel Logout. Clients are the linked products (Connect,
`crosscode.link/1`), with exact redirect addresses and the client secret derived from the link.
- Sign-in steps that all return to the product and page they started from: password, sign-up with
an emailed code, two-step sign-in (authenticator app, email, WhatsApp, recovery codes) and setting
it up when a product asks (`acr_values=mfa`) or for admins, privacy notice (asked again when a new
version is published), news question, forgot / reset password.
- The account page: details, email change by link, password, two-step sign-in, recovery codes,
news consent, recent activity, sign out everywhere, download my data (bundled from every linked
product), delete my account (approved by an admin, then every product, retried when a product
says "not yet").
- Admin: people (access-logged), deletion requests, the church profile (`crosscode.church/1`,
served at `/api/church/v1`, `church.changed` to products), linked products, sign-in settings,
email and WhatsApp, privacy notice versions, licence, audit log. First-run `/setup`.
- Hub protocol v2 (product `accounts`, `CCA-` licence; never read-only), registering by itself from
`HUB_LICENCE_KEY`.
- `crosscode` hooks (`scripts/products/accounts.sh`), `env.template.json`, PM2 example.