Merge pull request #270 from kevgliss/248

Closes #248
This commit is contained in:
kevgliss 2016-04-01 14:28:52 -07:00
commit b5a4b293a9
1 changed files with 18 additions and 17 deletions

View File

@ -8,27 +8,27 @@ angular.module('lemur')
this.authority = authority; this.authority = authority;
this.authority.maxDate = moment(this.authority.notAfter).subtract(1, 'days').format('YYYY/MM/DD'); this.authority.maxDate = moment(this.authority.notAfter).subtract(1, 'days').format('YYYY/MM/DD');
}, },
attachSubAltName: function () { attachSubAltName: function () {
if (this.extensions === undefined) { if (this.extensions === undefined) {
this.extensions = {}; this.extensions = {};
} }
if (this.extensions.subAltNames === undefined) { if (this.extensions.subAltNames === undefined) {
this.extensions.subAltNames = {'names': []}; this.extensions.subAltNames = {'names': []};
} }
if (!angular.isString(this.subAltType)) { if (!angular.isString(this.subAltType)) {
this.subAltType = 'CNAME'; this.subAltType = 'CNAME';
} }
if (angular.isString(this.subAltValue) && angular.isString(this.subAltType)) { if (angular.isString(this.subAltValue) && angular.isString(this.subAltType)) {
this.extensions.subAltNames.names.push({'nameType': this.subAltType, 'value': this.subAltValue}); this.extensions.subAltNames.names.push({'nameType': this.subAltType, 'value': this.subAltValue});
this.findDuplicates(); this.findDuplicates();
} }
this.subAltType = null; this.subAltType = null;
this.subAltValue = null; this.subAltValue = null;
}, },
removeSubAltName: function (index) { removeSubAltName: function (index) {
this.extensions.subAltNames.names.splice(index, 1); this.extensions.subAltNames.names.splice(index, 1);
this.findDuplicates(); this.findDuplicates();
@ -110,6 +110,7 @@ angular.module('lemur')
CertificateService.create = function (certificate) { CertificateService.create = function (certificate) {
certificate.attachSubAltName(); certificate.attachSubAltName();
certificate.attachCustom();
// Help users who may have just typed in their authority // Help users who may have just typed in their authority
if (!certificate.authority) { if (!certificate.authority) {
AuthorityService.findActiveAuthorityByName(certificate.selectedAuthority).then(function (authorities) { AuthorityService.findActiveAuthorityByName(certificate.selectedAuthority).then(function (authorities) {