mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-26 17:08:33 +01:00
fido u2f login flow
This commit is contained in:
parent
0135476b68
commit
c55d0449cb
@ -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));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -84,3 +84,28 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div ng-if="twoFactorProvider === 4">
|
||||
<p class="login-box-msg">
|
||||
Complete logging in with U2F.
|
||||
</p>
|
||||
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(token)" api-form="twoFactorPromise">
|
||||
<div class="callout callout-danger validation-errors" ng-show="twoFactorForm.$errors">
|
||||
<h4>Errors have occurred</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in twoFactorForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>Press the button on your security key to continue.</p>
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<a stop-click href="#" ng-click="anotherMethod()">Use another method?</a>
|
||||
</div>
|
||||
<div class="col-xs-5">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat" ng-disabled="twoFactorForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="twoFactorForm.$loading"></i>Log In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user