From f345992f80a090af4f9c3fce9c96fd263e7d0913 Mon Sep 17 00:00:00 2001 From: Jimmy Vo Date: Fri, 21 Feb 2025 15:15:06 -0500 Subject: [PATCH] [PM-17449] Enable managed users to update their email addresses. (#13495) --- .../settings/account/account.component.ts | 11 +------ .../account/change-email.component.ts | 29 +++++++------------ 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/apps/web/src/app/auth/settings/account/account.component.ts b/apps/web/src/app/auth/settings/account/account.component.ts index e7adec5f80e..37bf535062f 100644 --- a/apps/web/src/app/auth/settings/account/account.component.ts +++ b/apps/web/src/app/auth/settings/account/account.component.ts @@ -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$, diff --git a/apps/web/src/app/auth/settings/account/change-email.component.ts b/apps/web/src/app/auth/settings/account/change-email.component.ts index b05b2e46982..a49c0b5a2f8 100644 --- a/apps/web/src/app/auth/settings/account/change-email.component.ts +++ b/apps/web/src/app/auth/settings/account/change-email.component.ts @@ -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"); } };