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:
@@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user