Max end date as per start date + default validity 3 years
This commit is contained in:
@ -151,10 +151,11 @@
|
||||
uib-tooltip="yyyy/MM/dd"
|
||||
uib-datepicker-popup="yyyy/MM/dd"
|
||||
ng-model="certificate.validityStart"
|
||||
ng-change="certificate.setValidityEndDateRange(certificate.validityStart)"
|
||||
is-open="popup1.opened"
|
||||
datepicker-options="dateOptions"
|
||||
close-text="Close"
|
||||
max-date="certificate.authority.authorityCertificate.maxIssuanceDate"
|
||||
max-date="certificate.authority.authorityCertificate.notAfter"
|
||||
min-date="certificate.authority.authorityCertificate.notBefore"
|
||||
alt-input-formats="altInputFormats"
|
||||
placeholder="Start Date"
|
||||
@ -174,8 +175,8 @@
|
||||
is-open="popup2.opened"
|
||||
datepicker-options="dateOptions"
|
||||
close-text="Close"
|
||||
max-date="certificate.authority.authorityCertificate.maxIssuanceDate"
|
||||
min-date="certificate.authority.authorityCertificate.notBefore"
|
||||
max-date="certificate.authority.authorityCertificate.maxValidityEnd"
|
||||
min-date="certificate.authority.authorityCertificate.minValidityEnd"
|
||||
alt-input-formats="altInputFormats"
|
||||
placeholder="End Date"
|
||||
/>
|
||||
|
@ -164,6 +164,18 @@ angular.module('lemur')
|
||||
this.extensions.keyUsage.useDecipherOnly = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
setValidityEndDateRange: function (value) {
|
||||
// clear selected validity end date as we are about to calculate new range
|
||||
if(this.validityEnd) this.validityEnd = '';
|
||||
|
||||
// Minimum end date will be same as selected start date
|
||||
this.authority.authorityCertificate.minValidityEnd = value;
|
||||
|
||||
// Move max end date by maxIssuanceDays
|
||||
let endDate = new Date(value);
|
||||
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
||||
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -264,6 +276,9 @@ angular.module('lemur')
|
||||
}
|
||||
}
|
||||
|
||||
certificate.authority.authorityCertificate.minValidityEnd = defaults.authority.authorityCertificate.notBefore;
|
||||
certificate.authority.authorityCertificate.maxValidityEnd = defaults.authority.authorityCertificate.notAfter;
|
||||
|
||||
if (certificate.dnsProviderId) {
|
||||
certificate.dnsProvider = {id: certificate.dnsProviderId};
|
||||
}
|
||||
@ -292,3 +307,4 @@ angular.module('lemur')
|
||||
|
||||
return CertificateService;
|
||||
});
|
||||
|
||||
|
@ -144,6 +144,18 @@ angular.module('lemur')
|
||||
this.extensions.keyUsage.useDecipherOnly = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
setValidityEndDateRange: function (value) {
|
||||
// clear selected validity end date as we are about to calculate new range
|
||||
if(this.validityEnd) this.validityEnd = '';
|
||||
|
||||
// Minimum end date will be same as selected start date
|
||||
this.authority.authorityCertificate.minValidityEnd = value;
|
||||
|
||||
// Move max end date by maxIssuanceDays
|
||||
let endDate = new Date(value);
|
||||
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
||||
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -230,6 +242,9 @@ angular.module('lemur')
|
||||
certificate.authority = defaults.authority;
|
||||
}
|
||||
}
|
||||
|
||||
certificate.authority.authorityCertificate.minValidityEnd = defaults.authority.authorityCertificate.notBefore;
|
||||
certificate.authority.authorityCertificate.maxValidityEnd = defaults.authority.authorityCertificate.notAfter;
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user