admin: PKI validity no more hardcoded

This commit is contained in:
nemunaire 2019-11-25 14:49:19 +01:00
parent 14f5cf29b7
commit 4a490b1a33
3 changed files with 52 additions and 18 deletions

View file

@ -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);