mirror of
https://github.com/bitwarden/web
synced 2026-01-08 03:23:29 +00:00
purge vault
This commit is contained in:
24
src/app/settings/settingsPurgeController.js
Normal file
24
src/app/settings/settingsPurgeController.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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');
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user