1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 19:53:43 +00:00

billing license management when self hosted

This commit is contained in:
Kyle Spearrin
2017-08-14 12:10:00 -04:00
parent 226c201925
commit 09a7b4ea90
6 changed files with 135 additions and 9 deletions

View File

@@ -0,0 +1,30 @@
angular
.module('bit.settings')
.controller('settingsBillingUpdateLicenseController', function ($scope, $state, $uibModalInstance, apiService,
$analytics, toastr, validationService) {
$analytics.eventTrack('settingsBillingUpdateLicenseController', { category: 'Modal' });
$scope.submit = function (form) {
var fileEl = document.getElementById('file');
var files = fileEl.files;
if (!files || !files.length) {
validationService.addError(form, 'file', 'Select a license file.', true);
return;
}
var fd = new FormData();
fd.append('license', files[0]);
$scope.submitPromise = apiService.accounts.putLicense(fd)
.$promise.then(function (response) {
$analytics.eventTrack('Updated License');
toastr.success('You have updated your license.');
$uibModalInstance.close();
});
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});