supports duo platform util

This commit is contained in:
Kyle Spearrin 2018-05-16 15:30:28 -04:00
parent e6fde2e92b
commit cf5bce1ea9
3 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,7 @@ export abstract class PlatformUtilsService {
saveFile: (win: Window, blobData: any, blobOptions: any, fileName: string) => void; saveFile: (win: Window, blobData: any, blobOptions: any, fileName: string) => void;
getApplicationVersion: () => string; getApplicationVersion: () => string;
supportsU2f: (win: Window) => boolean; supportsU2f: (win: Window) => boolean;
supportsDuo: () => boolean;
showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string, showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string,
type?: string) => Promise<boolean>; type?: string) => Promise<boolean>;
isDev: () => boolean; isDev: () => boolean;

View File

@ -123,6 +123,10 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
return false; return false;
} }
supportsDuo(): boolean {
return true;
}
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string): showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
Promise<boolean> { Promise<boolean> {
const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText]; const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText];

View File

@ -127,7 +127,8 @@ export class AuthService {
return providers; return providers;
} }
if (this.twoFactorProviders.has(TwoFactorProviderType.OrganizationDuo)) { if (this.twoFactorProviders.has(TwoFactorProviderType.OrganizationDuo) &&
this.platformUtilsService.supportsDuo()) {
providers.push(TwoFactorProviders[TwoFactorProviderType.OrganizationDuo]); providers.push(TwoFactorProviders[TwoFactorProviderType.OrganizationDuo]);
} }
@ -139,7 +140,7 @@ export class AuthService {
providers.push(TwoFactorProviders[TwoFactorProviderType.Yubikey]); 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]); providers.push(TwoFactorProviders[TwoFactorProviderType.Duo]);
} }