src/Controller/SecurityController.php line 25

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * ImmoBay - BAUR Immobilien
  5.  *
  6.  * @copyright  Copyright (c) 2008-2022, 47GradNord - Agentur für Internetlösungen
  7.  * @author     47GradNord - Agentur für Internetlösungen <info@47gradnord.de>
  8.  */
  9. namespace App\Controller;
  10. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Routing\Annotation\Route;
  14. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  15. class SecurityController extends AbstractController
  16. {
  17.     /**
  18.      * @Route("/login", name="app_login")
  19.      */
  20.     public function login(Request $requestAuthenticationUtils $authenticationUtils): Response
  21.     {
  22.         // if ($this->getUser()) {
  23.         //     return $this->redirectToRoute('target_path');
  24.         // }
  25.         // get the login error if there is one
  26.         $error $authenticationUtils->getLastAuthenticationError();
  27.         // last username entered by the user
  28.         $lastUsername $authenticationUtils->getLastUsername();
  29.         return $this->render('security/login.html.twig', [
  30.             'last_username' => $lastUsername,
  31.             'error' => $error,
  32.             'relogin' => null !== $request->get('relogin'),
  33.         ]);
  34.     }
  35.     /**
  36.      * @Route("/logout", name="app_logout")
  37.      */
  38.     public function logout(): void
  39.     {
  40.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  41.     }
  42. }