purge vault

This commit is contained in:
Kyle Spearrin 2017-10-25 21:46:35 -04:00
parent a57110b935
commit f3eaf644b0
6 changed files with 72 additions and 2 deletions

View File

@ -35,6 +35,7 @@
delAdmin: { url: _apiUri + '/ciphers/:id/delete-admin', method: 'POST', params: { id: '@id' } },
delMany: { url: _apiUri + '/ciphers/delete', method: 'POST' },
moveMany: { url: _apiUri + '/ciphers/move', method: 'POST' },
purge: { url: _apiUri + '/ciphers/purge', method: 'POST' },
postAttachment: {
url: _apiUri + '/ciphers/:id/attachment',
method: 'POST',

View File

@ -129,6 +129,14 @@
});
};
$scope.purge = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/settings/views/settingsPurge.html',
controller: 'settingsPurgeController'
});
};
function scrollToTop() {
$('html, body').animate({ scrollTop: 0 }, 200);
}

View 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');
};
});

View File

@ -150,10 +150,13 @@
Careful, these actions are not reversible!
</div>
<div class="box-footer">
<button type="submit" class="btn btn-default btn-flat" ng-click="sessions()">
<button type="button" class="btn btn-default btn-flat" ng-click="sessions()">
Deauthorize Sessions
</button>
<button type="submit" class="btn btn-default btn-flat" ng-click="delete()">
<button type="button" class="btn btn-default btn-flat" ng-click="purge()">
Purge Vault
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="delete()">
Delete Account
</button>
</div>

View File

@ -0,0 +1,33 @@
<div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-trash"></i> Purge Vault</h4>
</div>
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
<div class="modal-body">
<p>
Continue below to delete all items in your vault. Items that belong to an organization that you share
with will not be deleted.
</p>
<div class="callout callout-warning">
<h4><i class="fa fa-warning"></i> Warning</h4>
Purging your vault is permanent. It cannot be undone.
</div>
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
<h4>Errors have occurred</h4>
<ul>
<li ng-repeat="e in form.$errors">{{e}}</li>
</ul>
</div>
<div class="form-group" show-errors>
<label for="masterPassword">Master Password</label>
<input type="password" id="masterPassword" name="MasterPasswordHash" ng-model="model.masterPassword"
class="form-control" required api-field />
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Purge
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div>
</form>

View File

@ -274,6 +274,7 @@
<script src="app/settings/settingsTwoStepController.js"></script>
<script src="app/settings/settingsAddEditEquivalentDomainController.js"></script>
<script src="app/settings/settingsDeleteController.js"></script>
<script src="app/settings/settingsPurgeController.js"></script>
<script src="app/settings/settingsCreateOrganizationController.js"></script>
<script src="app/settings/settingsBillingController.js"></script>
<script src="app/settings/settingsBillingAdjustStorageController.js"></script>