Ninlil sends a confirmation link to a new e-mail address and a notice to the old one #65

Closed
opened 2026-10-31 12:41:59 -04:00 by claude · 0 comments
Owner
  • Draft: BUG-55
  • Priority: medium
  • Agent: coder
  • Depends on: none
  • Decisions: Q-BUG-13, Q-BUG-16

Why

See #63. The only link mail today is the password reset (src/dotnet/src/Ninlil.Web/Services/PasswordResetLinkSender.cs).

What changes

  • New src/dotnet/src/Ninlil.Web/Services/EmailChangeLinkSender.cs, shaped like PasswordResetLinkSender:
    • CreateConfirmationLinkAsync(user, newEmail): a token from UserManager.GenerateChangeEmailTokenAsync, Base64Url-encoded as the reset token is (:114-116), in a link <PublicBaseUrl>/confirm-email-change?userId=…&email=…&token=… with every value escaped. It refuses without a usable PublicBaseUrl (reuse TryParsePublicBaseUrl, :67; move it to a shared helper if both senders need it). The link is never built from the request's Host header (:22-24).
    • SendConfirmationAsync: subject "Confirm your new Ninlil e-mail address", a short HTML body with the link and "if you did not ask for this, ignore this e-mail".
    • SendChangedNoticeAsync(oldEmail, newEmail) (Q-BUG-16): subject "Your Ninlil e-mail address was changed", naming the new address and telling the reader to contact an administrator if they did not make the change.
  • Registered as scoped in Program.cs next to PasswordResetLinkSender (:664).
  • No endpoint uses it yet; no API change.

Acceptance

  • Web.Tests with a fake IEmailSender, red first: the link lies under the configured base URL, carries the escaped values and round-trips through UserManager.ChangeEmailAsync; with a forged Host header the link is unchanged; without a base URL a ValidationException names the setting.
  • The notice goes to the old address and names the new one.

Source

#63; PasswordResetLinkSender.cs.
Owner decision 2026-10-31, round 2 (Q-BUG-16): "notify old address on change: yes".

- **Draft:** BUG-55 - **Priority:** medium - **Agent:** coder - **Depends on:** none - **Decisions:** Q-BUG-13, Q-BUG-16 ### Why See #63. The only link mail today is the password reset (`src/dotnet/src/Ninlil.Web/Services/PasswordResetLinkSender.cs`). ### What changes - New `src/dotnet/src/Ninlil.Web/Services/EmailChangeLinkSender.cs`, shaped like `PasswordResetLinkSender`: - `CreateConfirmationLinkAsync(user, newEmail)`: a token from `UserManager.GenerateChangeEmailTokenAsync`, Base64Url-encoded as the reset token is (`:114-116`), in a link `<PublicBaseUrl>/confirm-email-change?userId=…&email=…&token=…` with every value escaped. It refuses without a usable `PublicBaseUrl` (reuse `TryParsePublicBaseUrl`, `:67`; move it to a shared helper if both senders need it). The link is never built from the request's Host header (`:22-24`). - `SendConfirmationAsync`: subject "Confirm your new Ninlil e-mail address", a short HTML body with the link and "if you did not ask for this, ignore this e-mail". - `SendChangedNoticeAsync(oldEmail, newEmail)` (Q-BUG-16): subject "Your Ninlil e-mail address was changed", naming the new address and telling the reader to contact an administrator if they did not make the change. - Registered as scoped in `Program.cs` next to `PasswordResetLinkSender` (`:664`). - No endpoint uses it yet; no API change. ### Acceptance - [ ] Web.Tests with a fake `IEmailSender`, red first: the link lies under the configured base URL, carries the escaped values and round-trips through `UserManager.ChangeEmailAsync`; with a forged Host header the link is unchanged; without a base URL a `ValidationException` names the setting. - [ ] The notice goes to the old address and names the new one. ### Source #63; `PasswordResetLinkSender.cs`. Owner decision 2026-10-31, round 2 (Q-BUG-16): "notify old address on change: yes".
Sign in to join this conversation.
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.

Reference
lantea-one/ninlil#65
No description provided.