From d47fe66f1e681e1a5e10dee7cf3e33e79ab3ee17 Mon Sep 17 00:00:00 2001 From: Patrick Pimentel Date: Mon, 6 Jan 2025 11:02:46 -0500 Subject: [PATCH] refactor(email-verification-feature-flag): [PM-7882] Email Verification - Fixed typo and one more form control. --- apps/browser/src/auth/popup/home.component.ts | 24 +++++++------------ .../login/desktop-login-component.service.ts | 2 +- .../src/auth/login/login-v1.component.ts | 4 ++-- ...families-for-enterprise-setup.component.ts | 2 +- .../src/auth/components/login-v1.component.ts | 2 +- .../auth/components/two-factor.component.ts | 2 +- .../auth/src/angular/login/login.component.ts | 2 +- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/apps/browser/src/auth/popup/home.component.ts b/apps/browser/src/auth/popup/home.component.ts index e51d8bcf963..b8b724c4b60 100644 --- a/apps/browser/src/auth/popup/home.component.ts +++ b/apps/browser/src/auth/popup/home.component.ts @@ -8,10 +8,11 @@ import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ToastService } from "@bitwarden/components"; + import { AccountSwitcherService } from "./account-switching/services/account-switcher.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @Component({ selector: "app-home", @@ -23,7 +24,7 @@ export class HomeComponent implements OnInit, OnDestroy { private destroyed$: Subject = new Subject(); loginInitiated = false; - formGroup = this.formBuilder.group({ + formGroup = this.formBuilder.nonNullable.group({ email: ["", [Validators.required, Validators.email]], rememberEmail: [false], }); @@ -106,29 +107,22 @@ export class HomeComponent implements OnInit, OnDestroy { if (this.formGroup.invalid) { this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("invalidEmail"), }); return; } await this.setLoginEmailValues(); - await this.router.navigate(["login"], { queryParams: { email: this.formGroup.value.email } }); + await this.router.navigate(["login"], { + queryParams: { email: this.formGroup.controls.email.value }, + }); } async setLoginEmailValues() { - if (!this.formGroup.value.rememberEmail || !this.formGroup.value.email) { - this.logService.warning( - `Failed to setLoginEmailValues due to null value for either: - \n\tformGroup.value.rememberEmail: ${this.formGroup.value.rememberEmail} - \n\tformGroup.value.email: ${this.formGroup.value.email}`, - ); - return; - } - // Note: Browser saves email settings here instead of the login component - this.loginEmailService.setRememberEmail(this.formGroup.value.rememberEmail); - await this.loginEmailService.setLoginEmail(this.formGroup.value.email); + this.loginEmailService.setRememberEmail(this.formGroup.controls.rememberEmail.value); + await this.loginEmailService.setLoginEmail(this.formGroup.controls.email.value); await this.loginEmailService.saveEmailSettings(); } } diff --git a/apps/desktop/src/auth/login/desktop-login-component.service.ts b/apps/desktop/src/auth/login/desktop-login-component.service.ts index 8a2daef49ff..c651daea72b 100644 --- a/apps/desktop/src/auth/login/desktop-login-component.service.ts +++ b/apps/desktop/src/auth/login/desktop-login-component.service.ts @@ -68,7 +68,7 @@ export class DesktopLoginComponentService } catch (err) { this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("ssoError"), }); } diff --git a/apps/desktop/src/auth/login/login-v1.component.ts b/apps/desktop/src/auth/login/login-v1.component.ts index 3509d13a42a..1751604706d 100644 --- a/apps/desktop/src/auth/login/login-v1.component.ts +++ b/apps/desktop/src/auth/login/login-v1.component.ts @@ -191,7 +191,7 @@ export class LoginComponentV1 extends BaseLoginComponent implements OnInit, OnDe if (!this.formGroup.controls.email.valid) { this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("invalidEmail"), }); return; @@ -246,7 +246,7 @@ export class LoginComponentV1 extends BaseLoginComponent implements OnInit, OnDe } catch (err) { this.platformUtilsService.showToast( "error", - this.i18nService.t("errorOccured"), + this.i18nService.t("errorOccurred"), this.i18nService.t("ssoError"), ); } diff --git a/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts b/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts index 4d183e5d1d2..7c53100cd79 100644 --- a/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts +++ b/apps/web/src/app/admin-console/organizations/sponsorships/families-for-enterprise-setup.component.ts @@ -97,7 +97,7 @@ export class FamiliesForEnterpriseSetupComponent implements OnInit, OnDestroy { if (this.preValidateSponsorshipResponse.isFreeFamilyPolicyEnabled) { this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("offerNoLongerValid"), }); diff --git a/libs/angular/src/auth/components/login-v1.component.ts b/libs/angular/src/auth/components/login-v1.component.ts index 5a1f5014bc0..379f157b78a 100644 --- a/libs/angular/src/auth/components/login-v1.component.ts +++ b/libs/angular/src/auth/components/login-v1.component.ts @@ -358,7 +358,7 @@ export class LoginComponentV1 extends CaptchaProtectedComponent implements OnIni this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("encryptionKeyMigrationRequired"), }); return true; diff --git a/libs/angular/src/auth/components/two-factor.component.ts b/libs/angular/src/auth/components/two-factor.component.ts index 18bfe546600..12d5b1bdd64 100644 --- a/libs/angular/src/auth/components/two-factor.component.ts +++ b/libs/angular/src/auth/components/two-factor.component.ts @@ -268,7 +268,7 @@ export class TwoFactorComponent extends CaptchaProtectedComponent implements OnI this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("encryptionKeyMigrationRequired"), }); return true; diff --git a/libs/auth/src/angular/login/login.component.ts b/libs/auth/src/angular/login/login.component.ts index 33c167dcaed..dbe5eed71e7 100644 --- a/libs/auth/src/angular/login/login.component.ts +++ b/libs/auth/src/angular/login/login.component.ts @@ -268,7 +268,7 @@ export class LoginComponent implements OnInit, OnDestroy { } else { this.toastService.showToast({ variant: "error", - title: this.i18nService.t("errorOccured"), + title: this.i18nService.t("errorOccurred"), message: this.i18nService.t("encryptionKeyMigrationRequired"), }); }