not supported scenario

This commit is contained in:
Kyle Spearrin 2017-06-27 09:04:51 -04:00
parent 075ba931ea
commit 9f1c445214
4 changed files with 21 additions and 3 deletions

View File

@ -90,10 +90,19 @@ angular
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true }); var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true });
if (provider.length && provider[0].priority > providerPriority) { if (provider.length && provider[0].priority > providerPriority) {
if (provider[0].type === constants.twoFactorProvider.u2f && !u2f.isSupported) {
continue;
}
providerType = provider[0].type; providerType = provider[0].type;
providerPriority = provider[0].priority; providerPriority = provider[0].priority;
} }
} }
if (providerType === null) {
return null;
}
return parseInt(providerType); return parseInt(providerType);
} }

View File

@ -18,7 +18,7 @@
if (providers.hasOwnProperty(constants.twoFactorProvider.duo)) { if (providers.hasOwnProperty(constants.twoFactorProvider.duo)) {
add(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); add(constants.twoFactorProvider.u2f);
} }

View File

@ -143,6 +143,15 @@
</form> </form>
</div> </div>
<div ng-if="twoFactorProvider === null">
<p>
This account has two-factor login enabled, however, none of the configured two-factor providers are supported by this
web browser.
</p>
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).
</div>
<hr /> <hr />
<ul> <ul>
<li> <li>

View File

@ -22,7 +22,7 @@ var u2f = u2f || {};
* Modification: * Modification:
* Check if browser supports U2F API before this wrapper was added. * 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 * FIDO U2F Javascript API Version