diff --git a/js/app/controllers/settings.js b/js/app/controllers/settings.js index 8f0121b0..0b76b3af 100644 --- a/js/app/controllers/settings.js +++ b/js/app/controllers/settings.js @@ -156,6 +156,18 @@ $scope.cur_state = {}; + + $scope.$on("$locationChangeStart", function(event) { + if($scope.change_pw){ + if($scope.change_pw.total > 0 && $scope.change_pw.done < $scope.change_pw.total){ + if(!confirm("Are you sure you want to leave?\nThis will corrupt all your credentials")){ + event.preventDefault(); + } + } + } + }); + + $scope.changeVaultPassword = function (oldVaultPass, newVaultPass, newVaultPass2) { if (oldVaultPass !== VaultService.getActiveVault().vaultKey) { $scope.error = 'Your old password is incorrect!'; diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 24fb557e..79ec4690 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -240,6 +240,15 @@ }; + + $scope.$on("$locationChangeStart", function(event) { + if(!sharing_complete){ + if(!confirm("Are you sure you want to leave?\nThis will corrupt this credential")){ + event.preventDefault(); + } + } + }); + $scope.sharing_complete = true; $scope.applyShare = function () { $scope.sharing_complete = false; @@ -284,6 +293,7 @@ } } NotificationService.showNotification('Saved!', 4000); + $scope.sharing_complete = true; } else { ShareService.generateSharedKey(20).then(function (key) {