src/Controller/SecurityController.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\Routing\Annotation\Route;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\JsonResponse;
  8. use App\Settings\Settings;
  9. use App\Helper\FormHelper;
  10. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  11. //use App\Entity\Season;
  12. class SecurityController extends AbstractController {
  13.   /**
  14.      * @Route("/logout", name="logout", methods={"GET"})
  15.      */
  16.     public function logout(): void
  17.     {
  18.       // controller can be blank: it will never be executed!
  19.       throw new \Exception('Don\'t forget to activate logout in security.yaml');
  20.     }
  21.   /**
  22.    * @Route("/login", name="login")
  23.    */
  24.   public function loginAction(Request $requestAuthenticationUtils $authUtils) {
  25.     // get the login error if there is one
  26.     $error $authUtils->getLastAuthenticationError();
  27.     // last username entered by the user
  28.     $lastUsername $authUtils->getLastUsername();
  29.     //var_dump($lastUsername);
  30.     //var_dump($error);
  31.     return $this->render('security/login.html.twig', array(
  32.                 'last_username' => $lastUsername,
  33.                 'commonData' => Settings::getCommonData(),
  34.                 'error' => $error,
  35.     ));
  36.   }
  37. }