Do not inherit replacement info during cert clone

This commit is contained in:
sayali 2020-08-03 19:23:24 -07:00 committed by Hossein Shafagh
parent 69b64c63ea
commit e75e472a1a
1 changed files with 3 additions and 0 deletions

View File

@ -215,11 +215,14 @@ angular.module('lemur')
$scope.certificate = LemurRestangular.restangularizeElement(null, {}, 'certificates'); $scope.certificate = LemurRestangular.restangularizeElement(null, {}, 'certificates');
CertificateApi.get(editId).then(function (certificate) { CertificateApi.get(editId).then(function (certificate) {
$scope.certificate = certificate; $scope.certificate = certificate;
// prepare the certificate for cloning
$scope.certificate.name = ''; // we should prefer the generated name $scope.certificate.name = ''; // we should prefer the generated name
$scope.certificate.csr = null; // should not clone CSR in case other settings are changed in clone $scope.certificate.csr = null; // should not clone CSR in case other settings are changed in clone
$scope.certificate.validityStart = null; $scope.certificate.validityStart = null;
$scope.certificate.validityEnd = null; $scope.certificate.validityEnd = null;
$scope.certificate.keyType = 'RSA2048'; // default algo to show during clone $scope.certificate.keyType = 'RSA2048'; // default algo to show during clone
$scope.certificate.replacedBy = []; // should not clone 'replaced by' info
$scope.certificate.removeReplaces(); // should not clone 'replacement cert' info
CertificateService.getDefaults($scope.certificate); CertificateService.getDefaults($scope.certificate);
}); });