mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
[PM-17449] Enable managed users to update their email addresses. (#13495)
This commit is contained in:
@@ -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$,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
await this.apiService.postEmailToken(request);
|
||||
this.activateStep2();
|
||||
} else {
|
||||
const request = new EmailRequest();
|
||||
request.token = this.formGroup.value.token;
|
||||
@@ -100,18 +96,15 @@ 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({
|
||||
variant: "success",
|
||||
title: this.i18nService.t("emailChanged"),
|
||||
message: this.i18nService.t("logBackIn"),
|
||||
});
|
||||
this.messagingService.send("logout");
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
await this.apiService.postEmail(request);
|
||||
this.reset();
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: this.i18nService.t("emailChanged"),
|
||||
message: this.i18nService.t("logBackIn"),
|
||||
});
|
||||
this.messagingService.send("logout");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user