Datepicker enhancements
This commit is contained in:
parent
3efe14c43f
commit
6aedd3b0d8
|
@ -317,8 +317,6 @@ class Certificate(db.Model):
|
||||||
if self.name.lower() in [ca.lower() for ca in public_CA]:
|
if self.name.lower() in [ca.lower() for ca in public_CA]:
|
||||||
return current_app.config.get("PUBLIC_CA_MAX_VALIDITY_DAYS", 397)
|
return current_app.config.get("PUBLIC_CA_MAX_VALIDITY_DAYS", 397)
|
||||||
|
|
||||||
return current_app.config.get("DEFAULT_MAX_VALIDITY_DAYS", 1095) # 3 years default
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def subject(self):
|
def subject(self):
|
||||||
return self.parsed_cert.subject
|
return self.parsed_cert.subject
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
Certificate Authority
|
Certificate Authority
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<ui-select class="input-md" ng-model="certificate.authority" theme="bootstrap" title="choose an authority">
|
<ui-select class="input-md" ng-model="certificate.authority" theme="bootstrap" title="choose an authority" ng-change="clearDates()">
|
||||||
<ui-select-match placeholder="select an authority...">{{$select.selected.name}}</ui-select-match>
|
<ui-select-match placeholder="select an authority...">{{$select.selected.name}}</ui-select-match>
|
||||||
<ui-select-choices class="form-control" repeat="authority in authorities"
|
<ui-select-choices class="form-control" repeat="authority in authorities"
|
||||||
refresh="getAuthoritiesByName($select.search)"
|
refresh="getAuthoritiesByName($select.search)"
|
||||||
|
@ -159,6 +159,7 @@
|
||||||
min-date="certificate.authority.authorityCertificate.notBefore"
|
min-date="certificate.authority.authorityCertificate.notBefore"
|
||||||
alt-input-formats="altInputFormats"
|
alt-input-formats="altInputFormats"
|
||||||
placeholder="Start Date"
|
placeholder="Start Date"
|
||||||
|
readonly="true"
|
||||||
/>
|
/>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button type="button" class="btn btn-default" ng-click="open1()"><i
|
<button type="button" class="btn btn-default" ng-click="open1()"><i
|
||||||
|
@ -179,6 +180,7 @@
|
||||||
min-date="certificate.authority.authorityCertificate.minValidityEnd"
|
min-date="certificate.authority.authorityCertificate.minValidityEnd"
|
||||||
alt-input-formats="altInputFormats"
|
alt-input-formats="altInputFormats"
|
||||||
placeholder="End Date"
|
placeholder="End Date"
|
||||||
|
readonly="true"
|
||||||
/>
|
/>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button type="button" class="btn btn-default" ng-click="open2()"><i
|
<button type="button" class="btn btn-default" ng-click="open2()"><i
|
||||||
|
|
|
@ -167,17 +167,19 @@ angular.module('lemur')
|
||||||
},
|
},
|
||||||
setValidityEndDateRange: function (value) {
|
setValidityEndDateRange: function (value) {
|
||||||
// clear selected validity end date as we are about to calculate new range
|
// clear selected validity end date as we are about to calculate new range
|
||||||
if(this.validityEnd) {
|
this.validityEnd = '';
|
||||||
this.validityEnd = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimum end date will be same as selected start date
|
// Minimum end date will be same as selected start date
|
||||||
this.authority.authorityCertificate.minValidityEnd = value;
|
this.authority.authorityCertificate.minValidityEnd = value;
|
||||||
|
|
||||||
// Move max end date by maxIssuanceDays
|
if(!this.authority.authorityCertificate || !this.authority.authorityCertificate.maxIssuanceDays) {
|
||||||
let endDate = new Date(value);
|
this.authority.authorityCertificate.maxValidityEnd = this.authority.authorityCertificate.notAfter;
|
||||||
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
} else {
|
||||||
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
// Move max end date by maxIssuanceDays
|
||||||
|
let endDate = new Date(value);
|
||||||
|
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
||||||
|
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -147,17 +147,19 @@ angular.module('lemur')
|
||||||
},
|
},
|
||||||
setValidityEndDateRange: function (value) {
|
setValidityEndDateRange: function (value) {
|
||||||
// clear selected validity end date as we are about to calculate new range
|
// clear selected validity end date as we are about to calculate new range
|
||||||
if(this.validityEnd) {
|
this.validityEnd = '';
|
||||||
this.validityEnd = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimum end date will be same as selected start date
|
// Minimum end date will be same as selected start date
|
||||||
this.authority.authorityCertificate.minValidityEnd = value;
|
this.authority.authorityCertificate.minValidityEnd = value;
|
||||||
|
|
||||||
// Move max end date by maxIssuanceDays
|
if(!this.authority.authorityCertificate || !this.authority.authorityCertificate.maxIssuanceDays) {
|
||||||
let endDate = new Date(value);
|
this.authority.authorityCertificate.maxValidityEnd = this.authority.authorityCertificate.notAfter;
|
||||||
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
} else {
|
||||||
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
// Move max end date by maxIssuanceDays
|
||||||
|
let endDate = new Date(value);
|
||||||
|
endDate.setDate(endDate.getDate() + this.authority.authorityCertificate.maxIssuanceDays);
|
||||||
|
this.authority.authorityCertificate.maxValidityEnd = endDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue