[PM-35830] Add ChangeEmailCommand with DI#7650
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7650 +/- ##
==========================================
+ Coverage 59.87% 60.08% +0.20%
==========================================
Files 2121 2133 +12
Lines 93532 93950 +418
Branches 8301 8342 +41
==========================================
+ Hits 56001 56448 +447
+ Misses 35551 35518 -33
- Partials 1980 1984 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| { | ||
| // Will throw if the new email violates a claiming organization's domain policy. | ||
| await EnsureNewEmailMatchesClaimedDomainAsync(user, newEmail); | ||
|
|
There was a problem hiding this comment.
As discussed in Slack, I think that the Admin Console layer can handle this.
Validation such as checking the admin role, making sure the user is claimed, and making sure the new email address is claimed, is all part of the admin/organization domain that we will handle.
The cross-team dependency on Auth is much narrower: we don't own the User domain and we don't know how to update a user's email (in the narrow sense). So that is the main thing we are looking for here.
I think if you remove the claimed domain check in this method, everything else LGTM. Thank you!
|



🎟️ Tracking
PM-35830
📔 Objective
Introduces a new
ChangeEmailCommandthat encapsulates the user email change flow.IChangeEmailCommand/ChangeEmailCommandunderBit.Core.Auth.UserFeatures.UserEmail, including claimed-domain enforcement, duplicate-email rejection, Stripe customer email sync with rollback on failure, and post-change push notifications (logout vs. settings sync depending on whether the user has a master password).ChangeEmailCommandTestscovering claimed-domain enforcement, disabled claiming orgs, duplicate email, same-user email, Stripe sync, Stripe rollback, and push branching.This PR introduces the command only; switching callers from
UserService.ChangeEmailAsyncto the new command will follow in a separate PR.