1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 05:53:42 +00:00

refactor(email-verification-feature-flag): [PM-7882] Email Verification - Fixed typo and one more form control.

This commit is contained in:
Patrick Pimentel
2025-01-06 11:02:46 -05:00
parent 98428ec7f3
commit d47fe66f1e
7 changed files with 16 additions and 22 deletions

View File

@@ -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<void> = 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();
}
}

View File

@@ -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"),
});
}

View File

@@ -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"),
);
}

View File

@@ -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"),
});

View File

@@ -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;

View File

@@ -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;

View File

@@ -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"),
});
}