1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-06 09:20:43 +01:00

stop listening for u2f on destroy

This commit is contained in:
Kyle Spearrin 2017-07-24 12:02:57 -04:00
parent 55a50fac83
commit d6d535ed9e
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@ angular
$scope.state = $state;
$scope.twoFactorProviderConstants = constants.twoFactorProvider;
$scope.rememberTwoFactor = { checked: false };
var stopU2fCheck = true;
$scope.returnState = $state.params.returnState;
$scope.stateEmail = $state.params.email;
@ -199,6 +200,10 @@ angular
});
};
$scope.$on('$destroy', function () {
stopU2fCheck = true;
});
function loggedInGo() {
if ($scope.returnState) {
$state.go($scope.returnState.name, $scope.returnState.params);
@ -209,6 +214,7 @@ angular
}
function init() {
stopU2fCheck = true;
var params;
if ($scope.twoFactorProvider === constants.twoFactorProvider.duo) {
params = $scope.twoFactorProviders[constants.twoFactorProvider.duo];
@ -223,6 +229,7 @@ angular
});
}
else if ($scope.twoFactorProvider === constants.twoFactorProvider.u2f) {
stopU2fCheck = false;
params = $scope.twoFactorProviders[constants.twoFactorProvider.u2f];
var challenges = JSON.parse(params.Challenges);
@ -238,6 +245,10 @@ angular
}
function initU2f(challenges) {
if (stopU2fCheck) {
return;
}
if (challenges.length < 1 || $scope.twoFactorProvider !== constants.twoFactorProvider.u2f) {
return;
}

View File

@ -179,7 +179,7 @@ angular
}, 1000);
});
scope.$on("$destroy", function () {
scope.$on('$destroy', function () {
if (interval) {
clearInterval(interval);
}