mirror of
https://github.com/bitwarden/jslib
synced 2025-12-19 17:53:48 +00:00
Tweak naming of twoFactorService interface
This commit is contained in:
@@ -6,6 +6,7 @@ import { TwoFactorProviderType } from "jslib-common/enums/twoFactorProviderType"
|
||||
import { AuthService } from "jslib-common/abstractions/auth.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { TwoFactorService } from 'jslib-common/abstractions/twoFactor.service';
|
||||
|
||||
@Directive()
|
||||
export class TwoFactorOptionsComponent implements OnInit {
|
||||
@@ -15,7 +16,7 @@ export class TwoFactorOptionsComponent implements OnInit {
|
||||
providers: any[] = [];
|
||||
|
||||
constructor(
|
||||
protected authService: AuthService,
|
||||
protected twoFactorService: TwoFactorService,
|
||||
protected router: Router,
|
||||
protected i18nService: I18nService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
@@ -23,7 +24,7 @@ export class TwoFactorOptionsComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.providers = this.authService.getSupportedTwoFactorProviders(this.win);
|
||||
this.providers = this.twoFactorService.getSupportedProviders(this.win);
|
||||
}
|
||||
|
||||
choose(p: any) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
||||
|
||||
export abstract class TwoFactorService {
|
||||
getSupportedTwoFactorProviders: (win: Window) => any[];
|
||||
getSupportedProviders: (win: Window) => any[];
|
||||
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
||||
clearSelectedProvider: () => void;
|
||||
setProviders: (data: any) => void;
|
||||
|
||||
@@ -88,7 +88,7 @@ export class TwoFactorService implements TwoFactorServiceAbstraction {
|
||||
this.i18nService.t("yubiKeyDesc");
|
||||
}
|
||||
|
||||
getSupportedTwoFactorProviders(win: Window): any[] {
|
||||
getSupportedProviders(win: Window): any[] {
|
||||
const providers: any[] = [];
|
||||
if (this.twoFactorProvidersData == null) {
|
||||
return providers;
|
||||
|
||||
@@ -20,6 +20,7 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
|
||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
|
||||
|
||||
import { Response } from "../models/response";
|
||||
|
||||
@@ -58,7 +59,8 @@ export class LoginCommand {
|
||||
protected policyService: PolicyService,
|
||||
clientId: string,
|
||||
private syncService: SyncService,
|
||||
protected keyConnectorService: KeyConnectorService
|
||||
protected keyConnectorService: KeyConnectorService,
|
||||
protected twoFactorService: TwoFactorService
|
||||
) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
@@ -230,7 +232,7 @@ export class LoginCommand {
|
||||
}
|
||||
if (response.twoFactor) {
|
||||
let selectedProvider: any = null;
|
||||
const twoFactorProviders = this.authService.getSupportedTwoFactorProviders(null);
|
||||
const twoFactorProviders = this.twoFactorService.getSupportedProviders(null);
|
||||
if (twoFactorProviders.length === 0) {
|
||||
return Response.badRequest("No providers available for this client.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user