Files
slp-modular-cms/aidlc-docs/features/identity-email-notifications/handback.md
T

25 lines
3.7 KiB
Markdown

# Hand-back - identity-email-notifications (U1 + U2 + U3 and what followed)
Branch `feature/identity-email-notifications` (contains the whole andreaslop-site-hosting feature as well). Not merged, not on production. Deployed (test only): ASF test and SlpSoftware test (mail switched OFF there until the host gets its mail settings).
## 1. What exists
- **Mail core** (Core): `IEmailSender` (MailKit, StartTls, one timeout per step, failures are values), options with one decision point `IMailAvailability` (SMTP host set AND configuration valid, otherwise mail OFF with one Error line naming the settings), nl/en template (logo, brand colour, button plus raw link, plain-text part), language per user (user, invitation, site default, nl).
- **Site settings** (new table `SiteSettings`): sender address chosen only from `Email:AllowedFromAddresses` plus the default, sender name 1..80 characters; Owner changes, Administrator reads; Mail card on the Settings page (only when mail is on).
- **Flows**: invitation mail (language chosen by the administrator), new link (choice: copy only / copy and mail), resend, notices on deactivation, reactivation, role change, password reset (`forgot-password`, `reset-password`; request touches nothing, only a completed reset revokes sessions; link single use, 60 minutes; per-address cooldown 5 minutes; the request is handled after the response so timing does not reveal accounts).
- **Security**: the security stamp is part of the access token (a password change/reset ends earlier access tokens, refresh keeps working); deactivated/deleted users refused at once; role hierarchy in the API; no secret, address, token or link in any log.
## 2. Configuration for a host (see construction/mail-foundation/infrastructure-design)
`Email__Smtp__Host/Port/EnableSsl/Username/Password/TimeoutSeconds`, `App__PublicBaseUrl`, `Email__FromAddress`, `Email__FromName`, `Email__AllowedFromAddresses__n`, optional `Email__LogoUrl`, `Email__BrandColor`, `App__DefaultLanguage`, `Identity__Invitation__ExpiryHours`, `Identity__PasswordReset__*`. All per host in `shared/env`. A host without a mail setting is unchanged; no new variable is required by this release.
## 3. Behaviour changes for SlpSoftware (when it is on a release with this branch)
First deploy: three additive migrations (`SiteSettings`, `Users.PreferredLanguage`, `Invitations.Language`), existing access tokens refused once (silent refresh), a password change ends earlier access tokens, user management API stricter (role hierarchy, caller recognition by id), a deactivated or deleted user is refused at once (one extra query per authenticated request), availability gate covers `/api/` only, setup status read under the ordinary limiter, expired invitations listed, two new anonymous endpoints (404 while mail is off), default Identity token providers registered. Mail stays off without an SMTP host.
## 4. Verification
See `construction/build-and-test/build-and-test-summary.md` (including the update of 2026-11-09). Real MariaDB: migrations up, down, up and the `DateTimeOffset` round trip (CI and locally in a throw-away container). Not yet done: the manual real test mail on ASF test.
## 5. Open items
1. Real test mail from ASF test (needs the sender address on `andreaslop.nl` via env and the TLS mode of `mail.andreaslop.nl` confirmed; the failure log now names the phase and SMTP status).
2. Operations stage: questions in `operations/plans/operations-questions.md` (for Bryan), nothing executed.
3. Merge to master and the SlpSoftware production roll-out: not approved.
4. Optional follow-up decisions: per-user language is in, per-site template editing is not; whether "Gebruiker uitnodigen" should also ask before mailing (Bryan: no, unchanged).