From a1bda338b1f08645bc2e9385799507200bac760b Mon Sep 17 00:00:00 2001 From: Giovanny BRUNET Date: Thu, 28 Nov 2024 17:14:42 +0100 Subject: [PATCH 1/2] login --- composer.json | 2 +- composer.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index d113d15..f4ed66d 100644 --- a/composer.json +++ b/composer.json @@ -102,7 +102,7 @@ "symfony/browser-kit": "7.1.*", "symfony/css-selector": "7.1.*", "symfony/debug-bundle": "7.1.*", - "symfony/maker-bundle": "^1.0", + "symfony/maker-bundle": "^1.61", "symfony/phpunit-bridge": "^7.1", "symfony/stopwatch": "7.1.*", "symfony/web-profiler-bundle": "7.1.*" diff --git a/composer.lock b/composer.lock index 618986c..b47ebfe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cf8a9d35993fbd4e8f038bfd58abc5a5", + "content-hash": "e99a99b4ca2d6b58821cb711cb543c93", "packages": [ { "name": "composer/semver", @@ -428,16 +428,16 @@ }, { "name": "doctrine/doctrine-bundle", - "version": "2.13.0", + "version": "2.13.1", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563" + "reference": "2740ad8b8739b39ab37d409c972b092f632b025a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/ca59d84b8e63143ce1aed90cdb333ba329d71563", - "reference": "ca59d84b8e63143ce1aed90cdb333ba329d71563", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/2740ad8b8739b39ab37d409c972b092f632b025a", + "reference": "2740ad8b8739b39ab37d409c972b092f632b025a", "shasum": "" }, "require": { @@ -451,7 +451,7 @@ "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/deprecation-contracts": "^2.1 || ^3", - "symfony/doctrine-bridge": "^5.4.19 || ^6.0.7 || ^7.0", + "symfony/doctrine-bridge": "^5.4.46 || ^6.4.3 || ^7.0.3", "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", "symfony/polyfill-php80": "^1.15", "symfony/service-contracts": "^1.1.1 || ^2.0 || ^3" @@ -528,7 +528,7 @@ ], "support": { "issues": "https://github.com/doctrine/DoctrineBundle/issues", - "source": "https://github.com/doctrine/DoctrineBundle/tree/2.13.0" + "source": "https://github.com/doctrine/DoctrineBundle/tree/2.13.1" }, "funding": [ { @@ -544,7 +544,7 @@ "type": "tidelift" } ], - "time": "2024-09-01T09:46:40+00:00" + "time": "2024-11-08T23:27:54+00:00" }, { "name": "doctrine/doctrine-migrations-bundle", @@ -9840,5 +9840,5 @@ "ext-iconv": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From a3ed387f206e60d70f6b21337665664f50355817 Mon Sep 17 00:00:00 2001 From: Giovanny BRUNET Date: Thu, 28 Nov 2024 17:15:31 +0100 Subject: [PATCH 2/2] 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