From 444f63db42285f433ea349aa8eeac01c6847c319 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 25 Jul 2017 15:00:20 -0400 Subject: [PATCH] callback whenever closing modal --- .../settingsTwoStepAuthenticatorController.js | 11 +++++++++++ src/app/settings/settingsTwoStepDuoController.js | 11 +++++++++++ src/app/settings/settingsTwoStepEmailController.js | 11 +++++++++++ src/app/settings/settingsTwoStepU2fController.js | 10 ++++++++-- src/app/settings/settingsTwoStepYubiController.js | 11 +++++++++++ src/app/settings/views/settingsTwoStepYubi.html | 2 +- 6 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/app/settings/settingsTwoStepAuthenticatorController.js b/src/app/settings/settingsTwoStepAuthenticatorController.js index 2110a82d67..e21e51e12e 100644 --- a/src/app/settings/settingsTwoStepAuthenticatorController.js +++ b/src/app/settings/settingsTwoStepAuthenticatorController.js @@ -91,7 +91,18 @@ }).$promise; } + var closing = false; $scope.close = function () { + closing = true; $uibModalInstance.close($scope.enabled); }; + + $scope.$on('modal.closing', function (e, reason, closed) { + if (closing) { + return; + } + + e.preventDefault(); + $scope.close(); + }); }); diff --git a/src/app/settings/settingsTwoStepDuoController.js b/src/app/settings/settingsTwoStepDuoController.js index 9a8a3ed70e..20ed5144c0 100644 --- a/src/app/settings/settingsTwoStepDuoController.js +++ b/src/app/settings/settingsTwoStepDuoController.js @@ -75,7 +75,18 @@ }; } + var closing = false; $scope.close = function () { + closing = true; $uibModalInstance.close($scope.enabled); }; + + $scope.$on('modal.closing', function (e, reason, closed) { + if (closing) { + return; + } + + e.preventDefault(); + $scope.close(); + }); }); diff --git a/src/app/settings/settingsTwoStepEmailController.js b/src/app/settings/settingsTwoStepEmailController.js index f6bc85ca54..42133f7a1f 100644 --- a/src/app/settings/settingsTwoStepEmailController.js +++ b/src/app/settings/settingsTwoStepEmailController.js @@ -97,7 +97,18 @@ }).$promise; } + var closing = false; $scope.close = function () { + closing = true; $uibModalInstance.close($scope.enabled); }; + + $scope.$on('modal.closing', function (e, reason, closed) { + if (closing) { + return; + } + + e.preventDefault(); + $scope.close(); + }); }); diff --git a/src/app/settings/settingsTwoStepU2fController.js b/src/app/settings/settingsTwoStepU2fController.js index f72fae46d7..c92cf2842d 100644 --- a/src/app/settings/settingsTwoStepU2fController.js +++ b/src/app/settings/settingsTwoStepU2fController.js @@ -102,10 +102,16 @@ } $scope.close = function () { + closed = true; $uibModalInstance.close($scope.enabled); }; - $scope.$on('modal.closing', function (event) { - closed = true; + $scope.$on('modal.closing', function (e, reason, isClosed) { + if (closed) { + return; + } + + e.preventDefault(); + $scope.close(); }); }); diff --git a/src/app/settings/settingsTwoStepYubiController.js b/src/app/settings/settingsTwoStepYubiController.js index 55d512ec44..7adfe28256 100644 --- a/src/app/settings/settingsTwoStepYubiController.js +++ b/src/app/settings/settingsTwoStepYubiController.js @@ -99,7 +99,18 @@ return str; } + var closing = false; $scope.close = function () { + closing = true; $uibModalInstance.close($scope.enabled); }; + + $scope.$on('modal.closing', function (e, reason, closed) { + if (closing) { + return; + } + + e.preventDefault(); + $scope.close(); + }); }); diff --git a/src/app/settings/views/settingsTwoStepYubi.html b/src/app/settings/views/settingsTwoStepYubi.html index 68a337201f..5853e77cf3 100644 --- a/src/app/settings/views/settingsTwoStepYubi.html +++ b/src/app/settings/views/settingsTwoStepYubi.html @@ -38,7 +38,7 @@

Supported platforms: