SMTP settings on the Settings page, with a test (1.2.0)

SMTP server, port, user, password and from address are now Hub settings in
the database instead of SMTP_* in .env. The password is encrypted with
HUB_ENCRYPTION_KEY and never sent to the browser; a blank field keeps it.
POST /api/admin/settings/smtp-test logs in with the form's values (saved or
not) and sends a test email, returning the server's reason on failure; it is
rate limited and audited. On first start an existing SMTP_* setup is copied
into Settings once. The audit log no longer records the SMTP password.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMaqhrehXcHJe32jLL9
This commit is contained in:
2026-10-28 01:26:41 +02:00
co-authored by Claude Opus 5.5
parent ad01328ce3
commit 613a4450cb
13 changed files with 298 additions and 35 deletions
+3 -2
View File
@@ -147,7 +147,6 @@ Set at least:
| `HUB_ENCRYPTION_KEY` | `openssl rand -base64 48`. **Never change this** once installs have registered |
| `HUB_SIGNING_KEY_FILE` | `./keys/hub-signing-key.pem` (the default) |
| `TRUST_PROXY` | `1` |
| `SMTP_*`, `ALERT_EMAIL` | your mail settings, so alerts get sent |
```bash
chmod 600 .env
@@ -259,7 +258,9 @@ curl -s https://events-hub.crosscode.co.za/api/health # {"ok":true}
```
Then open `https://events-hub.crosscode.co.za`, log in, and set up two-factor (required on
first login). In **Settings**, check that the public key shown matches the one in Cross Events.
first login). In **Settings**, check that the public key shown matches the one in Cross Events,
then fill in **Email (SMTP)** and the **Alert email**, and press **Send test** to check the mail
server accepts the login. Without SMTP, alerts are only logged.
Point Cross Events installs at the Hub with `HUB_URL=https://events-hub.crosscode.co.za` in their
`backend/.env`.