src/App/Controller/LoginController.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Controller;
  3. use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
  4. use \LogicException;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class LoginController extends AbstractController
  9. {
  10.     public function login(AuthenticationUtils $authenticationUtils): Response
  11.     {
  12.         if (null !== $this->getUser()) {
  13.             return $this->redirectToRoute('feed');
  14.         }
  15.         // get the login error if there is one
  16.         $error $authenticationUtils->getLastAuthenticationError();
  17.         // last username entered by the user
  18.         $lastUsername $authenticationUtils->getLastUsername();
  19.         return $this->render('security/login.html.twig', [
  20.             'last_username' => $lastUsername,
  21.             'error' => $error,
  22.             'recaptchaForm' => $this->createForm(EWZRecaptchaType::class)->createView(),
  23.         ]);
  24.     }
  25.     public function logout(): void
  26.     {
  27.         throw new LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  28.     }
  29. }