Better custom cert handling in the superuser tool

We now only allow certificates ending in .crt to be uploaded and we automatically install the certificate once it has been validated
This commit is contained in:
Joseph Schorr 2017-03-24 17:00:51 -04:00
parent da8032fe61
commit e509eb4cba
6 changed files with 58 additions and 18 deletions

View file

@ -1322,10 +1322,12 @@ angular.module("core-config-setup", ['angularFileUpload'])
},
controller: function($scope, $element, $upload, ApiService, UserService) {
$scope.resetUpload = 0;
$scope.certsUploading = false;
var loadCertificates = function() {
$scope.certificatesResource = ApiService.getCustomCertificatesAsResource().get(function(resp) {
$scope.certInfo = resp;
$scope.certsUploading = false;
});
};
@ -1336,6 +1338,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
});
$scope.handleCertsSelected = function(files, callback) {
$scope.certsUploading = true;
$upload.upload({
url: '/api/v1/superuser/customcerts/' + files[0].name,
method: 'POST',