identity-email-notifications: execution plan, application design en units

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 17:58:54 +01:00
co-authored by Claude Sonnet 5.5
parent 10032f5096
commit 1a2fb56e1e
6 changed files with 224 additions and 6 deletions
@@ -0,0 +1,21 @@
# Units of Work - identity-email-notifications
Order: U1, then U2, then U3. Hand-back and approval after each unit. Each unit runs Code Generation with its own build and test; functional and NFR design are light and recorded in the unit's code summary.
## U1 mail-foundation
- Core: `IEmailSender`, `SmtpEmailSender`, `NullEmailSender`, `EmailOptions` + start-up validation, `MailSendResult`, `IMailTemplateRenderer` + nl/en resources + shared layout, `ILanguageResolver`, fake sender for tests.
- `SiteSettings` table + migration, `ISiteSettingsService`, `SiteSettingsController`, Mail card (Owner edits, Administrator reads), `emailEnabled` and `defaultLanguage` in system capabilities.
- Config documentation (appsettings placeholders, env secrets `Email__Smtp__Username/Password`, smtp4dev), `Infrastructure Design` for the host.
- Tests: option validation, sender behaviour with an in-process SMTP stub, renderer (encoding, header injection, fallback), settings (allowlist, roles), PBT-02/03/07/08/09 targets for renderer and validator.
## U2 identity-mail-flows
- Migration: `Users.PreferredLanguage`, `Invitations.Language`. Profile language select; login applies the user's language.
- `IIdentityMailService` and its use in invite, regenerate, new resend action, deactivate/reactivate and role change; response `mail` result; invite dialog language and result; resend action in the users list.
- Tests: each mail kind with the fake sender; failure never fails the action; hierarchy for resend; language fallback chain; migration up/down on MariaDB; UI tests.
## U3 password-reset
- `forgot-password` / `reset-password`, Identity default token provider (lifetime configurable, default 60 minutes), `ResetCooldown`, revocation of refresh tokens on completion only, stamp in access tokens (decision D2), login link, `/forgot-password` and `/reset-password` pages.
- Tests: request leaves password, stamp and sessions untouched; completed reset revokes refresh tokens, old password fails, token single-use; identical responses for known and unknown addresses; cooldown; rate limiter wired; PBT for link round trip.
## Dependencies
U2 needs U1 (sender, renderer, capabilities). U3 needs U1 and U2 (language column, mail service). No unit changes behaviour for a host without mail configuration.