mirror of
https://github.com/tips-of-mine/gestion-certificats2.git
synced 2025-06-28 15:08:42 +02:00
This commit addresses several issues:
1. **`intermediate_cert_name` unique constraint violation**: When creating a perimeter, the intermediate certificate name (`intermediate_cert_name`) stored in the `functional_perimeters` table was always `"intermediate.cert.pem"`. This caused a duplicate error if a unique constraint existed on this column. * Fixed in `PerimeterController.php` by using `$perimeterName . "_intermediate.cert.pem"` as the value for `intermediate_cert_name`, ensuring uniqueness. The physical file name remains `intermediate.cert.pem` in the perimeter's subdirectory. 2. **`Undefined variable $userRole` warning**: On the page listing perimeters (`app/src/Views/perimeters/index.php`), the `$userRole` variable was not defined by the controller. * Fixed in `PerimeterController.php` (method `index()`) by initializing `$userRole = $this->authService->getUserRole();`. 3. **SQL error `Unknown column 'common_name'` during initialization**: During the application initialization process (if no user or root certificate exists), an attempt to insert into the `certificates` table included a `common_name` column that does not exist. * Fixed in `app/public/index.php` by removing the `common_name` column and its value from the insert query for the root certificate. These corrections improve the robustness of perimeter creation and make the application initialization process more reliable.
This commit is contained in:
@ -142,8 +142,8 @@ if ($userCount === 0 || !$rootCertExists) {
|
||||
$expirationDate = $expirationTimestamp ? date('Y-m-d H:i:s', $expirationTimestamp) : (new DateTime('+10 years'))->format('Y-m-d H:i:s');
|
||||
|
||||
// Enregistrer le certificat root dans la base de données
|
||||
$stmt = $dbInstance->prepare("INSERT INTO certificates (name, type, common_name, expiration_date) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute(['ca.cert.pem', 'root', $_SESSION['init_root_domain'], $expirationDate]);
|
||||
$stmt = $dbInstance->prepare("INSERT INTO certificates (name, type, expiration_date) VALUES (?, ?, ?)");
|
||||
$stmt->execute(['ca.cert.pem', 'root', $expirationDate]);
|
||||
} else {
|
||||
echo "<p style=\"color: red;\">Erreur lors de la création du certificat Root CA. Veuillez vérifier les logs PHP et Docker.</p>";
|
||||
echo "<pre>" . htmlspecialchars($output) . "</pre>";
|
||||
|
Reference in New Issue
Block a user