1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00
Files
web/src/app/settings/settingsPurgeController.js
Kyle Spearrin f3eaf644b0 purge vault
2017-10-25 21:46:35 -04:00

25 lines
1.0 KiB
JavaScript

angular
.module('bit.settings')
.controller('settingsPurgeController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
authService, toastr, $analytics, tokenService) {
$analytics.eventTrack('settingsPurgeController', { category: 'Modal' });
$scope.submit = function (model) {
$scope.submitPromise = cryptoService.hashPassword(model.masterPassword).then(function (hash) {
return apiService.ciphers.purge({
masterPasswordHash: hash
}).$promise;
}).then(function () {
$uibModalInstance.dismiss('cancel');
$analytics.eventTrack('Purged Vault');
return $state.go('backend.user.vault', { refreshFromServer: true });
}).then(function () {
toastr.success('All items in your vault have been deleted.', 'Vault Purged');
});
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});