From cf5bce1ea91ebbc1c99a550b62114a88bfeb2036 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 16 May 2018 15:30:28 -0400 Subject: [PATCH] supports duo platform util --- src/abstractions/platformUtils.service.ts | 1 + src/electron/services/electronPlatformUtils.service.ts | 4 ++++ src/services/auth.service.ts | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/abstractions/platformUtils.service.ts b/src/abstractions/platformUtils.service.ts index 05bbfaab7d..c15da85f2c 100644 --- a/src/abstractions/platformUtils.service.ts +++ b/src/abstractions/platformUtils.service.ts @@ -18,6 +18,7 @@ export abstract class PlatformUtilsService { saveFile: (win: Window, blobData: any, blobOptions: any, fileName: string) => void; getApplicationVersion: () => string; supportsU2f: (win: Window) => boolean; + supportsDuo: () => boolean; showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string, type?: string) => Promise; isDev: () => boolean; diff --git a/src/electron/services/electronPlatformUtils.service.ts b/src/electron/services/electronPlatformUtils.service.ts index 6c4509e0a1..c6444e183e 100644 --- a/src/electron/services/electronPlatformUtils.service.ts +++ b/src/electron/services/electronPlatformUtils.service.ts @@ -123,6 +123,10 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { return false; } + supportsDuo(): boolean { + return true; + } + showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string): Promise { const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText]; diff --git a/src/services/auth.service.ts b/src/services/auth.service.ts index 318dceebf8..2eaaa0fe14 100644 --- a/src/services/auth.service.ts +++ b/src/services/auth.service.ts @@ -127,7 +127,8 @@ export class AuthService { return providers; } - if (this.twoFactorProviders.has(TwoFactorProviderType.OrganizationDuo)) { + if (this.twoFactorProviders.has(TwoFactorProviderType.OrganizationDuo) && + this.platformUtilsService.supportsDuo()) { providers.push(TwoFactorProviders[TwoFactorProviderType.OrganizationDuo]); } @@ -139,7 +140,7 @@ export class AuthService { providers.push(TwoFactorProviders[TwoFactorProviderType.Yubikey]); } - if (this.twoFactorProviders.has(TwoFactorProviderType.Duo)) { + if (this.twoFactorProviders.has(TwoFactorProviderType.Duo) && this.platformUtilsService.supportsDuo()) { providers.push(TwoFactorProviders[TwoFactorProviderType.Duo]); }