mirror of
https://github.com/bitwarden/browser
synced 2026-02-20 11:24:07 +00:00
Add web and desktop noop cache services
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from "./web-two-factor-auth-component.service";
|
||||
export * from "./web-two-factor-auth-duo-component.service";
|
||||
export * from "./web-two-factor-form-cache.service";
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Observable, of } from "rxjs";
|
||||
|
||||
import { TwoFactorFormCacheService, TwoFactorFormData } from "@bitwarden/auth/angular";
|
||||
|
||||
/**
|
||||
* No-op implementation of TwoFactorFormCacheService for web app
|
||||
*/
|
||||
@Injectable()
|
||||
export class WebTwoFactorFormCacheService extends TwoFactorFormCacheService {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
isEnabled$(): Observable<boolean> {
|
||||
return of(false);
|
||||
}
|
||||
|
||||
formData$(): Observable<TwoFactorFormData | null> {
|
||||
return of(null);
|
||||
}
|
||||
|
||||
async saveFormData(): Promise<void> {
|
||||
// No-op
|
||||
}
|
||||
|
||||
async clearFormData(): Promise<void> {
|
||||
// No-op
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { Subject, takeUntil, lastValueFrom } from "rxjs";
|
||||
|
||||
import { TwoFactorComponentV1 as BaseTwoFactorComponent } from "@bitwarden/angular/auth/components/two-factor-v1.component";
|
||||
import { WINDOW } from "@bitwarden/angular/services/injection-tokens";
|
||||
import { TwoFactorFormCacheService } from "@bitwarden/auth/angular";
|
||||
import {
|
||||
LoginStrategyServiceAbstraction,
|
||||
LoginEmailServiceAbstraction,
|
||||
@@ -74,6 +75,7 @@ export class TwoFactorComponentV1 extends BaseTwoFactorComponent implements OnIn
|
||||
toastService: ToastService,
|
||||
private formBuilder: FormBuilder,
|
||||
@Inject(WINDOW) protected win: Window,
|
||||
twoFactorFormCacheService: TwoFactorFormCacheService,
|
||||
) {
|
||||
super(
|
||||
loginStrategyService,
|
||||
@@ -95,6 +97,7 @@ export class TwoFactorComponentV1 extends BaseTwoFactorComponent implements OnIn
|
||||
masterPasswordService,
|
||||
accountService,
|
||||
toastService,
|
||||
twoFactorFormCacheService,
|
||||
);
|
||||
this.onSuccessfulLoginNavigate = this.goAfterLogIn;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
LoginDecryptionOptionsService,
|
||||
TwoFactorAuthComponentService,
|
||||
TwoFactorAuthDuoComponentService,
|
||||
TwoFactorFormCacheService,
|
||||
} from "@bitwarden/auth/angular";
|
||||
import {
|
||||
InternalUserDecryptionOptionsServiceAbstraction,
|
||||
@@ -117,6 +118,7 @@ import {
|
||||
WebTwoFactorAuthDuoComponentService,
|
||||
} from "../auth";
|
||||
import { WebSsoComponentService } from "../auth/core/services/login/web-sso-component.service";
|
||||
import { WebTwoFactorFormCacheService } from "../auth/core/services/two-factor-auth/web-two-factor-form-cache.service";
|
||||
import { AcceptOrganizationInviteService } from "../auth/organization-invite/accept-organization.service";
|
||||
import { HtmlStorageService } from "../core/html-storage.service";
|
||||
import { I18nService } from "../core/i18n.service";
|
||||
@@ -274,6 +276,11 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: WebTwoFactorAuthComponentService,
|
||||
deps: [],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: TwoFactorFormCacheService,
|
||||
useClass: WebTwoFactorFormCacheService,
|
||||
deps: [],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: SetPasswordJitService,
|
||||
useClass: WebSetPasswordJitService,
|
||||
|
||||
Reference in New Issue
Block a user