The server can build and send the e-mail change confirmation link and the changed-address notice #283

Merged
claude merged 1 commit from feature/65-email-change-mails into develop 2026-11-05 04:28:40 -05:00
Owner

This adds EmailChangeLinkSender, the mail side of the self-service e-mail change (epic #63). No endpoint calls it yet; #66 adds the endpoints.

  • CreateConfirmationLinkAsync builds <PublicBaseUrl>/confirm-email-change?userId=…&email=…&token=…. The token comes from GenerateChangeEmailTokenAsync and is Base64Url-encoded, and every value is escaped.
  • The link is built only from the configured base URL, never from the request's Host header. Without a usable base URL the call fails with a ValidationException that names publicBaseUrl / NINLIL_EMAIL_PUBLIC_BASE_URL.
  • SendConfirmationAsync mails the link to the new address. SendChangedNoticeAsync tells the old address which new address was set and to contact an administrator. Every interpolated value is HTML-encoded.
  • The class is registered as scoped next to PasswordResetLinkSender. No API change.

Tests:

  • Five tests in EmailChangeLinkSenderTests. The link round-trips through UserManager.ChangeEmailAsync, and a forged Host header leaves it unchanged. A missing base URL is refused, both mails go to the right recipients, and HTML is encoded.
  • All five were red against a stub first.
  • The whole Ninlil.Web.Tests project passes 2043 tests.
  • The verifier passed the change. It checked the encoding and header injection (MailKit's MailboxAddress.Parse rejects CR/LF in recipients).

Closes #65

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

This adds `EmailChangeLinkSender`, the mail side of the self-service e-mail change (epic #63). No endpoint calls it yet; #66 adds the endpoints. - `CreateConfirmationLinkAsync` builds `<PublicBaseUrl>/confirm-email-change?userId=…&email=…&token=…`. The token comes from `GenerateChangeEmailTokenAsync` and is Base64Url-encoded, and every value is escaped. - The link is built only from the configured base URL, never from the request's Host header. Without a usable base URL the call fails with a `ValidationException` that names `publicBaseUrl` / `NINLIL_EMAIL_PUBLIC_BASE_URL`. - `SendConfirmationAsync` mails the link to the new address. `SendChangedNoticeAsync` tells the old address which new address was set and to contact an administrator. Every interpolated value is HTML-encoded. - The class is registered as scoped next to `PasswordResetLinkSender`. No API change. Tests: - Five tests in `EmailChangeLinkSenderTests`. The link round-trips through `UserManager.ChangeEmailAsync`, and a forged Host header leaves it unchanged. A missing base URL is refused, both mails go to the right recipients, and HTML is encoded. - All five were red against a stub first. - The whole `Ninlil.Web.Tests` project passes 2043 tests. - The verifier passed the change. It checked the encoding and header injection (MailKit's `MailboxAddress.Parse` rejects CR/LF in recipients). Closes #65 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The server can build and send the e-mail change confirmation link and the changed-address notice
Some checks failed
Build / Pack and Push NuGet Packages (common) (push) Has been skipped
Build / Build Binary (linux-arm64) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (push) Has been skipped
Build / Build Binary (macos-amd64) (push) Has been skipped
Build / Build Binary (macos-arm64) (push) Has been skipped
Build / Build Binary (windows-amd64) (push) Has been skipped
Build / Build Arch Linux Packages (push) Has been skipped
Build / Smoke Test the Windows Binary (push) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Has been skipped
Build / Build and Push Image (push) Has been skipped
Build / Publish Release (push) Has been skipped
Build / Pipeline (push) Failing after 0s
Build / Test .NET (pull_request) Failing after 58m14s
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Stage Draft Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
ff73824ba4
Closes #65

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit b9a751518f into develop 2026-11-05 04:28:40 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!283
No description provided.