src/Controller/SecurityController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\H3\TTControllerTrait;
  4. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  5. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  9. class SecurityController extends AbstractDashboardController
  10. {
  11.     use TTControllerTrait;
  12.     /**
  13.      * @Route("/login", name="app_login")
  14.      */
  15.     public function login(AuthenticationUtils $authenticationUtilsParameterBagInterface $params): Response
  16.     {
  17.         // if ($this->getUser()) {
  18.         //     return $this->redirectToRoute('target_path');
  19.         // }
  20.         // get the login error if there is one
  21.         $error $authenticationUtils->getLastAuthenticationError();
  22.         // last username entered by the user
  23.         $lastUsername $authenticationUtils->getLastUsername();
  24.         return $this->render(
  25.             '@EasyAdmin/page/login.html.twig', [
  26.                 'last_username' => $lastUsername'error' => $error,
  27.                 'page_title' => $params->get('site_name'),
  28.                 'csrf_token_intention' => 'authenticate',
  29.                 'username_parameter' => 'username',
  30.                 'password_parameter' => 'password',
  31.             ]
  32.         );
  33.     }
  34.     /**
  35.      * @Route("/logout", name="app_logout")
  36.      */
  37.     public function logout()
  38.     {
  39.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  40.     }
  41. }