1
0
mirror of https://github.com/bitwarden/web synced 2025-12-15 07:43:16 +00:00

fido u2f login flow

This commit is contained in:
Kyle Spearrin
2017-06-22 23:16:02 -04:00
parent 0135476b68
commit c55d0449cb
2 changed files with 42 additions and 1 deletions

View File

@@ -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));
});
}
}
});