Epic: users change their own e-mail address on the profile page, with confirmation by link when the administrator requires it #63

Closed
opened 2026-10-31 12:41:59 -04:00 by claude · 1 comment
Owner
  • Draft: BUG-53
  • Priority: medium (the profile shows the address read-only; only an administrator can change it today)
  • Agent: none (epic)
  • Depends on: none
  • Decisions: Q-BUG-13, Q-BUG-15, Q-BUG-16, R2-EMAIL-SIGNOUT

Why

GET/PATCH /api/users/me expose a read-only e-mail address (src/dotnet/src/Ninlil.Web/Controllers/UsersController.cs:32-35,358-410); the PATCH ignores email (UserProfileControllerTests.cs:199). The owner wants self-service, governed by a new global setting "require e-mail confirmation": on, a link goes to the new address and the change applies when it is opened; off, the change applies at once.

What changes

Children, in order:

  • #64: the setting (options class, registry, ENVIRONMENT.md), on by default.
  • #65: the confirmation and notice mails.
  • #66: the self-service and confirmation endpoints, and the setting on /api/identity-settings.
  • #67: snapshot and client.
  • #68: the profile page, the confirmation page and the identity settings switch.

Rules that hold across the children:

  • The setting is on by default (Q-BUG-15), on new and upgraded installs.
  • The change needs the current password, as ChangeMyPassword does and for the same reason (UsersController.cs:36-37): the address receives password-reset links and e-mail two-factor codes, so a stolen session must not be able to redirect them.
  • The address must be valid and unique (RequireUniqueEmail is on, src/dotnet/src/Ninlil.Dns.Identity/Extension/ServiceCollectionIdentityExtension.cs:67).
  • Email two-factor sends codes only to a confirmed address (TwoFactorController.cs:86,277). The confirmation path sets EmailConfirmed; the immediate path keeps the confirmed state the administrator's change in UsersController.Update (:205) leaves, so the two paths that skip confirmation behave alike. README says that with confirmation off a mistyped address can cut off e-mail two-factor codes.
  • When the address changes (at once, or when the link is opened), a notice goes to the old address when SMTP is configured (Q-BUG-16).
  • Changing the address updates the security stamp, so every session of the account ends, the current one included, as after a password change (Q-REL-14, R2-EMAIL-SIGNOUT). The console signs the user out with a message.
  • The change replicates to cluster peers through UserAccountChangedEvent, as every account change does.

Acceptance

  • Children closed. README account and Security sections describe the flow, the setting and its default.

Source

UsersController.cs:27-40,358-410; UserProfileControllerTests.cs:199.
Owner decision 2026-10-31 (Q-BUG-13): "self-service on the profile page; a new global setting
'require e-mail confirmation': on = link to the new address, applies on confirm; off = applies at once".
Owner decisions 2026-10-31, round 2: Q-BUG-15 "default on"; Q-BUG-16 "notify the old address"; R2-EMAIL-SIGNOUT "e-mail change signs out all sessions".

- **Draft:** BUG-53 - **Priority:** medium (the profile shows the address read-only; only an administrator can change it today) - **Agent:** none (epic) - **Depends on:** none - **Decisions:** Q-BUG-13, Q-BUG-15, Q-BUG-16, R2-EMAIL-SIGNOUT ### Why `GET`/`PATCH /api/users/me` expose a read-only e-mail address (`src/dotnet/src/Ninlil.Web/Controllers/UsersController.cs:32-35,358-410`); the PATCH ignores `email` (`UserProfileControllerTests.cs:199`). The owner wants self-service, governed by a new global setting "require e-mail confirmation": on, a link goes to the new address and the change applies when it is opened; off, the change applies at once. ### What changes Children, in order: - #64: the setting (options class, registry, ENVIRONMENT.md), on by default. - #65: the confirmation and notice mails. - #66: the self-service and confirmation endpoints, and the setting on `/api/identity-settings`. - #67: snapshot and client. - #68: the profile page, the confirmation page and the identity settings switch. Rules that hold across the children: - The setting is on by default (Q-BUG-15), on new and upgraded installs. - The change needs the current password, as `ChangeMyPassword` does and for the same reason (`UsersController.cs:36-37`): the address receives password-reset links and e-mail two-factor codes, so a stolen session must not be able to redirect them. - The address must be valid and unique (`RequireUniqueEmail` is on, `src/dotnet/src/Ninlil.Dns.Identity/Extension/ServiceCollectionIdentityExtension.cs:67`). - Email two-factor sends codes only to a confirmed address (`TwoFactorController.cs:86,277`). The confirmation path sets `EmailConfirmed`; the immediate path keeps the confirmed state the administrator's change in `UsersController.Update` (`:205`) leaves, so the two paths that skip confirmation behave alike. README says that with confirmation off a mistyped address can cut off e-mail two-factor codes. - When the address changes (at once, or when the link is opened), a notice goes to the old address when SMTP is configured (Q-BUG-16). - Changing the address updates the security stamp, so every session of the account ends, the current one included, as after a password change (Q-REL-14, R2-EMAIL-SIGNOUT). The console signs the user out with a message. - The change replicates to cluster peers through `UserAccountChangedEvent`, as every account change does. ### Acceptance - [ ] Children closed. README account and Security sections describe the flow, the setting and its default. ### Source `UsersController.cs:27-40,358-410`; `UserProfileControllerTests.cs:199`. Owner decision 2026-10-31 (Q-BUG-13): "self-service on the profile page; a new global setting 'require e-mail confirmation': on = link to the new address, applies on confirm; off = applies at once". Owner decisions 2026-10-31, round 2: Q-BUG-15 "default on"; Q-BUG-16 "notify the old address"; R2-EMAIL-SIGNOUT "e-mail change signs out all sessions".
Author
Owner

All children merged into develop: #64 (PR #282), #65 (PR #283), #66, #67 and #68 (PR #286). The README Security section describes the flow, the setting NINLIL_IDENTITY_EMAIL_CHANGE_REQUIRE_CONFIRMATION and its default (on). Follow-ups: #284, #285.

All children merged into develop: #64 (PR #282), #65 (PR #283), #66, #67 and #68 (PR #286). The README Security section describes the flow, the setting `NINLIL_IDENTITY_EMAIL_CHANGE_REQUIRE_CONFIRMATION` and its default (on). Follow-ups: #284, #285.
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.

Dependencies

No dependencies set

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