1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 13:40:06 +00:00

Check cache before sending email for v1 component

This commit is contained in:
Alec Rippberger
2025-03-05 11:21:43 -06:00
parent aa7b9f0319
commit 1e86220e3c
2 changed files with 8 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ export class TwoFactorComponentV1 extends BaseTwoFactorComponent implements OnIn
toastService: ToastService,
@Inject(WINDOW) protected win: Window,
private browserMessagingApi: ZonedMessageListenerService,
private twoFactorFormCacheService: TwoFactorFormCacheService,
protected twoFactorFormCacheService: TwoFactorFormCacheService,
) {
super(
loginStrategyService,
@@ -91,6 +91,7 @@ export class TwoFactorComponentV1 extends BaseTwoFactorComponent implements OnIn
masterPasswordService,
accountService,
toastService,
twoFactorFormCacheService,
);
this.onSuccessfulLogin = async () => {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.

View File

@@ -8,6 +8,7 @@ import { first } from "rxjs/operators";
// eslint-disable-next-line no-restricted-imports
import { WINDOW } from "@bitwarden/angular/services/injection-tokens";
import { TwoFactorFormCacheService } from "@bitwarden/auth/angular";
import {
LoginStrategyServiceAbstraction,
LoginEmailServiceAbstraction,
@@ -100,6 +101,7 @@ export class TwoFactorComponentV1 extends CaptchaProtectedComponent implements O
protected masterPasswordService: InternalMasterPasswordServiceAbstraction,
protected accountService: AccountService,
protected toastService: ToastService,
protected twoFactorFormCacheService: TwoFactorFormCacheService,
) {
super(environmentService, i18nService, platformUtilsService, toastService);
@@ -438,6 +440,10 @@ export class TwoFactorComponentV1 extends CaptchaProtectedComponent implements O
return;
}
if ((await this.twoFactorFormCacheService.getFormData()).emailSent) {
return;
}
if ((await this.loginStrategyService.getEmail()) == null) {
this.toastService.showToast({
variant: "error",