diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js index cc25604c2a..dd21e10c21 100644 --- a/src/app/accounts/accountsLoginController.js +++ b/src/app/accounts/accountsLoginController.js @@ -2,7 +2,7 @@ angular .module('bit.accounts') .controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService, - $state, constants, $analytics, $uibModal, $timeout) { + $state, constants, $analytics, $uibModal, $timeout, $window) { $scope.state = $state; var returnState; @@ -118,5 +118,21 @@ angular } }); } + else if ($scope.twoFactorProvider === constants.twoFactorProvider.u2f) { + var params = $scope.twoFactorProviders[constants.twoFactorProvider.u2f]; + var challenges = JSON.parse(params.Challenges); + if (challenges.length < 1) { + return; + } + + $window.u2f.sign(challenges[0].appId, challenges[0].challenge, [{ + version: challenges[0].version, + keyHandle: challenges[0].keyHandle + }], function (data) { + console.log('call back data:'); + console.log(data); + $scope.twoFactor(JSON.stringify(data)); + }); + } } }); diff --git a/src/app/accounts/views/accountsLoginTwoFactor.html b/src/app/accounts/views/accountsLoginTwoFactor.html index aef91aadf5..90b4804b58 100644 --- a/src/app/accounts/views/accountsLoginTwoFactor.html +++ b/src/app/accounts/views/accountsLoginTwoFactor.html @@ -84,3 +84,28 @@ + +
+ Complete logging in with U2F. +
+ +