From 9f902c431a3cf132ff9fae7178177f643cef6ac7 Mon Sep 17 00:00:00 2001 From: "vivien.dufour" Date: Fri, 10 Nov 2023 15:10:51 +0100 Subject: [PATCH] add error 401 and 403 on error page --- public/index.php | 3 +-- src/Views/error.html.twig | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 455da20..c749c6e 100644 --- a/public/index.php +++ b/public/index.php @@ -44,8 +44,7 @@ $router->map("POST", "/submit-twig", fn() => $sampleFormController->submitFormTw $match = $router->match(); if ($match == null) { - $error = "404"; - $errorController->displayError($error); + $errorController->displayError("404"); http_response_code(404); exit(1); } diff --git a/src/Views/error.html.twig b/src/Views/error.html.twig index 30290ae..6dd967b 100644 --- a/src/Views/error.html.twig +++ b/src/Views/error.html.twig @@ -20,6 +20,10 @@ {% if error == "404" %}

Erreur 404 : cette page n'existe pas

+{% elseif error == "401" %} +

Erreur 401 : vous devez vous authentifier afin d'accèder à cette page

+{% elseif error == "403" %} +

Erreur 403 : vous n'avez pas les autorisations nécessaires pour accèder à cette page

{% endif %}