1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

update 2fa setup pages

This commit is contained in:
Kyle Spearrin
2017-06-24 11:26:24 -04:00
parent 73eb743f54
commit 7a19d444f1
4 changed files with 42 additions and 28 deletions

View File

@@ -5,6 +5,7 @@
authService, toastr, $analytics, constants, $timeout, $window) {
$analytics.eventTrack('settingsTwoStepU2fController', { category: 'Modal' });
var _masterPasswordHash;
var closed = false;
$scope.deviceResponse = null;
$scope.deviceListening = false;
@@ -24,6 +25,12 @@
};
$scope.readDevice = function () {
if (closed) {
return;
}
console.log('listening for key...');
$scope.deviceResponse = null;
$scope.deviceError = false;
$scope.deviceListening = true;
@@ -33,11 +40,11 @@
challenge: $scope.challenge.Challenge
}], [], function (data) {
$scope.deviceListening = false;
console.log('call back data:');
console.log(data);
if (data.errorCode) {
if (data.errorCode === 5) {
$scope.readDevice();
return;
}
else if (data.errorCode) {
$scope.deviceError = true;
$scope.$apply();
console.log('error: ' + data.errorCode);
@@ -46,7 +53,7 @@
$scope.deviceResponse = JSON.stringify(data);
$scope.$apply();
});
}, 5);
};
$scope.submit = function () {
@@ -90,4 +97,8 @@
$scope.close = function () {
$uibModalInstance.close($scope.enabled);
};
$scope.$on('modal.closing', function (event) {
closed = true;
});
});