admin: PKI validity no more hardcoded
This commit is contained in:
parent
14f5cf29b7
commit
4a490b1a33
3 changed files with 52 additions and 18 deletions
|
|
@ -570,6 +570,12 @@ angular.module("FICApp")
|
|||
})
|
||||
|
||||
.controller("PKIController", function($scope, $rootScope, Certificate, CACertificate, Team, $location, $http) {
|
||||
var ts = Date.now() - Date.now() % 86400000;
|
||||
var d = new Date(ts);
|
||||
$scope.notBefore = d.toISOString();
|
||||
var f = new Date(ts + 3 * 86400000);
|
||||
$scope.notAfter = f.toISOString();
|
||||
|
||||
$scope.teams = Team.query();
|
||||
$scope.certificates = Certificate.query();
|
||||
$scope.certificates.$promise.then(function(certificates) {
|
||||
|
|
@ -612,7 +618,7 @@ angular.module("FICApp")
|
|||
};
|
||||
|
||||
$scope.generateCA = function() {
|
||||
$http.post("/api/ca/new").then(function() {
|
||||
$http.post("/api/ca/new", {"notbefore": $scope.notBefore, "notafter": $scope.notAfter}).then(function() {
|
||||
$scope.ca = CACertificate.get();
|
||||
}, function(response) {
|
||||
$rootScope.newBox('danger', 'An error occurs when generating CA:', response.data.errmsg);
|
||||
|
|
|
|||
|
|
@ -115,6 +115,19 @@
|
|||
|
||||
<div class="alert alert-info" ng-if="!ca.version">
|
||||
<strong>Aucune CA n'a été générée pour le moment.</strong>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="CAnotBefore" class="col-sm-3 col-form-label">Début de validité</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control form-control-sm" id="CAnotBefore" ng-model="notBefore">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="CAnotAfter" class="col-sm-3 col-form-label">Fin de validité</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control form-control-sm" id="CAnotAfter" ng-model="notAfter">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dl ng-if="ca.version">
|
||||
|
|
|
|||
Reference in a new issue