From a3ed387f206e60d70f6b21337665664f50355817 Mon Sep 17 00:00:00 2001 From: Giovanny BRUNET Date: Thu, 28 Nov 2024 17:15:31 +0100 Subject: [PATCH] login --- src/Controller/AuthenticationController.php | 32 +++++++++++++++++++ templates/authentication/index.html.twig | 35 +++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/Controller/AuthenticationController.php create mode 100644 templates/authentication/index.html.twig diff --git a/src/Controller/AuthenticationController.php b/src/Controller/AuthenticationController.php new file mode 100644 index 0000000..c6be245 --- /dev/null +++ b/src/Controller/AuthenticationController.php @@ -0,0 +1,32 @@ +getLastAuthenticationError(); + + // last username entered by the user + $lastUsername = $authenticationUtils->getLastUsername(); + + return $this->render('authentication/index.html.twig', [ + 'last_username' => $lastUsername, + 'error' => $error, + ]); + } + + #[Route(path: '/logout', name: '_logout')] + public function logout(): void + { + throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); + } +} \ No newline at end of file diff --git a/templates/authentication/index.html.twig b/templates/authentication/index.html.twig new file mode 100644 index 0000000..c40b41a --- /dev/null +++ b/templates/authentication/index.html.twig @@ -0,0 +1,35 @@ + + +{% block title %}Log in!{% endblock %} + +{% block body %} +
+ {% if error %} +
{{ error.messageKey|trans(error.messageData, 'security') }}
+ {% endif %} + + {% if app.user %} +
+ You are logged in as {{ app.user.userIdentifier }}, Logout +
+ {% endif %} + +

Please sign in

+ + + + + + + +
+ + +
+ + + +
+{% endblock %} \ No newline at end of file