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()); const hasMasterPassword$ = from(this.userVerificationService.hasMasterPassword());
this.showChangeEmail$ = combineLatest([ this.showChangeEmail$ = hasMasterPassword$;
hasMasterPassword$,
isAccountDeprovisioningEnabled$,
userIsManagedByOrganization$,
]).pipe(
map(
([hasMasterPassword, isAccountDeprovisioningEnabled, userIsManagedByOrganization]) =>
hasMasterPassword && (!isAccountDeprovisioningEnabled || !userIsManagedByOrganization),
),
);
this.showPurgeVault$ = combineLatest([ this.showPurgeVault$ = combineLatest([
isAccountDeprovisioningEnabled$, isAccountDeprovisioningEnabled$,

View File

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