Skip to content

fix(identity): drop the unused Email field from UpdateUserCommand - #1454

Merged
iammukeshm merged 1 commit into
mainfrom
fix/update-user-drop-email
Nov 3, 2026
Merged

iammukeshm merged 1 commit into
mainfrom
fix/update-user-drop-email

Conversation

@iammukeshm

Copy link
Copy Markdown
Member

UpdateUserCommand.Email was validated as an e-mail address, but UpdateUserCommandHandler never passed it to IUserService.UpdateAsync. A client that sent a new address to PUT /api/v1/identity/profile got a 200 and nothing changed. Changing an e-mail properly needs a confirmation flow (GenerateChangeEmailTokenAsync / ChangeEmailAsync), so as proposed in the issue the field is removed from the command and its validator instead of being wired straight through. A real "change e-mail with confirmation" endpoint can be tracked separately.

This is a small contract change. The API uses the default System.Text.Json setting for unknown members (JsonUnmappedMemberHandling.Skip; neither ConfigureHttpJsonOptions in Program.cs nor the endpoint changes it), so a client that still sends email is not rejected: the property is skipped, the rest of the update applies and the address stays as it was, which is the same outcome as before. The only behavioural difference is that a malformed email used to fail validation with a 400 and is now ignored. The field also disappears from the OpenAPI schema.

Clients: the dashboard's updateMyProfile was sending email: profile.email on every save. It no longer does, and its doc comment no longer claims e-mail has its own endpoint. The Playwright test that asserted email in the PUT body now asserts it is absent. The admin app only calls PUT /profile/image, so it needed no change.

Testing:

  • New integration test UpdateProfile_Should_LeaveEmailUnchanged_When_BodyCarriesAnEmail: a PUT with firstName plus a different email returns 200, the first name is saved, and the e-mail is unchanged.
  • Removed the validator test for the deleted rule, and moved the pt-BR built-in message test from the e-mail rule to the phone number max-length rule (it now pins FluentValidation's Portuguese "deve ser menor ou igual a 15 caracteres" text).
  • Build is clean with warnings as errors. Full solution suite: 2,137 tests, 0 failures (Identity.Tests 339, Architecture.Tests 55, Integration.Tests 791).
  • Dashboard: npm run lint 0 errors (12 existing warnings), tsc -b --noEmit clean, tests/settings/profile.spec.ts 12/12 passing (also 36/36 with --repeat-each=3).

Docs: fullstackhero/docs#274

Closes #1431

UpdateUserCommand.Email was validated as an e-mail address but the
handler never passed it on, so PUT /profile answered 200 and left the
address unchanged. Changing an e-mail needs a confirmation flow, so the
field is removed from the command and its validator instead of being
wired through. The dashboard profile save no longer sends it.

Closes #1431
@iammukeshm
iammukeshm merged commit b9c1b27 into main Nov 3, 2026
20 checks passed
iammukeshm added a commit that referenced this pull request Nov 3, 2026
…1459)

- admin: the language switcher's profile save sends If-Match with the ETag
  of the read it merges from, retries once on 412, and no longer sends the
  email field the API dropped in #1454
- admin: apiFetch gains the onResponse hook the dashboard already has
- dashboard: the container renders defaultLanguage from FSH_DEFAULT_LANGUAGE
  like the admin does; compose passes it to both apps, Terraform sets it on
  the dashboard site, and the container CI job asserts the en-US default
- dashboard: drop the English-text fallback for the deactivated-tenant 403,
  now that the API always sends the Multitenancy.TenantDeactivated code
- both: add the missing t dependency to the upload hook and the file
  preview effect, so error text follows a language switch
- admin: remove the unused theme-toggle component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UpdateUserCommand.Email is validated but never written

1 participant