From 97e99c604afdca4210d192bc23bf447aad4c05f8 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 28 Jun 2018 02:21:07 +0300 Subject: [PATCH] Web login form bug fix. --- src/Controller/SecurityController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 50e6ccf..36d11de 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -8,20 +8,19 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\{FormError, FormInterface}; use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; -use Symfony\Component\Translation\TranslatorInterface; class SecurityController extends Controller { - public function login(Request $request, AuthenticationUtils $authenticationUtils, TranslatorInterface $translator): Response + public function login(Request $request, AuthenticationUtils $authenticationUtils): Response { - $lastError = $authenticationUtils->getLastAuthenticationError() ? $authenticationUtils->getLastAuthenticationError()->getMessage() : ''; + $lastError = $authenticationUtils->getLastAuthenticationError(); $lastUsername = $authenticationUtils->getLastUsername(); $form = $this->createLoginForm($lastUsername); $form->handleRequest($request); if ($lastError) { - $form->addError(new FormError($lastError)); + $form->addError(new FormError($lastError->getMessage())); } return $this->render('Security/login.html.twig', ['form' => $form->createView()]);