From 9f1c445214b7e130258dcb8348b3956d9ecd7abe Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 27 Jun 2017 09:04:51 -0400 Subject: [PATCH] not supported scenario --- src/app/accounts/accountsLoginController.js | 9 +++++++++ .../accounts/accountsTwoFactorMethodsController.js | 2 +- src/app/accounts/views/accountsLoginTwoFactor.html | 11 ++++++++++- src/js/u2f-api.js | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js index f371e0f6ab..aec7cc68aa 100644 --- a/src/app/accounts/accountsLoginController.js +++ b/src/app/accounts/accountsLoginController.js @@ -90,10 +90,19 @@ angular for (var i = 0; i < keys.length; i++) { var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true }); if (provider.length && provider[0].priority > providerPriority) { + if (provider[0].type === constants.twoFactorProvider.u2f && !u2f.isSupported) { + continue; + } + providerType = provider[0].type; providerPriority = provider[0].priority; } } + + if (providerType === null) { + return null; + } + return parseInt(providerType); } diff --git a/src/app/accounts/accountsTwoFactorMethodsController.js b/src/app/accounts/accountsTwoFactorMethodsController.js index 5b0ce66175..36f3be3d9e 100644 --- a/src/app/accounts/accountsTwoFactorMethodsController.js +++ b/src/app/accounts/accountsTwoFactorMethodsController.js @@ -18,7 +18,7 @@ if (providers.hasOwnProperty(constants.twoFactorProvider.duo)) { add(constants.twoFactorProvider.duo); } - if (providers.hasOwnProperty(constants.twoFactorProvider.u2f)) { + if (providers.hasOwnProperty(constants.twoFactorProvider.u2f) && u2f.isSupported) { add(constants.twoFactorProvider.u2f); } diff --git a/src/app/accounts/views/accountsLoginTwoFactor.html b/src/app/accounts/views/accountsLoginTwoFactor.html index c9120d4cbe..9961e22f23 100644 --- a/src/app/accounts/views/accountsLoginTwoFactor.html +++ b/src/app/accounts/views/accountsLoginTwoFactor.html @@ -143,6 +143,15 @@ +
+

+ This account has two-factor login enabled, however, none of the configured two-factor providers are supported by this + web browser. +

+ Please use a supported web browser (such as Chrome) and/or add additional providers that are better supported + across web browsers (such as an Authenticator App). +
+
\ No newline at end of file + diff --git a/src/js/u2f-api.js b/src/js/u2f-api.js index 909aaf4518..bba8a3a1e8 100644 --- a/src/js/u2f-api.js +++ b/src/js/u2f-api.js @@ -22,7 +22,7 @@ var u2f = u2f || {}; * Modification: * Check if browser supports U2F API before this wrapper was added. */ -u2f.isSupported = ((typeof u2f !== 'undefined') && u2f.register) || (chrome && chrome.runtime); +u2f.isSupported = !!(((typeof u2f !== 'undefined') && u2f.register) || (chrome && chrome.runtime)); /** * FIDO U2F Javascript API Version