1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

[PM-17449] Enable managed users to update their email addresses. (#13495)

This commit is contained in:
Jimmy Vo
2025-02-21 15:15:06 -05:00
committed by GitHub
parent a50cff75ff
commit f345992f80
2 changed files with 12 additions and 28 deletions

View File

@@ -59,16 +59,7 @@ export class AccountComponent implements OnInit, OnDestroy {
const hasMasterPassword$ = from(this.userVerificationService.hasMasterPassword());
this.showChangeEmail$ = combineLatest([
hasMasterPassword$,
isAccountDeprovisioningEnabled$,
userIsManagedByOrganization$,
]).pipe(
map(
([hasMasterPassword, isAccountDeprovisioningEnabled, userIsManagedByOrganization]) =>
hasMasterPassword && (!isAccountDeprovisioningEnabled || !userIsManagedByOrganization),
),
);
this.showChangeEmail$ = hasMasterPassword$;
this.showPurgeVault$ = combineLatest([
isAccountDeprovisioningEnabled$,

View File

@@ -74,12 +74,8 @@ export class ChangeEmailComponent implements OnInit {
step1Value.masterPassword,
await this.keyService.getOrDeriveMasterKey(step1Value.masterPassword),
);
try {
await this.apiService.postEmailToken(request);
this.activateStep2();
} catch (e) {
this.logService.error(e);
}
} else {
const request = new EmailRequest();
request.token = this.formGroup.value.token;
@@ -100,7 +96,7 @@ export class ChangeEmailComponent implements OnInit {
);
const newUserKey = await this.keyService.encryptUserKeyWithMasterKey(newMasterKey);
request.key = newUserKey[1].encryptedString;
try {
await this.apiService.postEmail(request);
this.reset();
this.toastService.showToast({
@@ -109,9 +105,6 @@ export class ChangeEmailComponent implements OnInit {
message: this.i18nService.t("logBackIn"),
});
this.messagingService.send("logout");
} catch (e) {
this.logService.error(e);
}
}
};