src/Controller/SecurityController.php line 26

Open in your IDE?
  1. <?php
  2. // src/Controller/RegistrationController.php
  3. namespace App\Controller;
  4. use App\Entity\AppUser;
  5. use App\Form\RegistrationFormType;
  6. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  13. /**
  14.  * @Route("/{_locale}")
  15.  */
  16. class SecurityController extends AbstractController
  17. {
  18.     
  19.     /**
  20.      * @Route("/login", name="security_login")
  21.      * @return \Symfony\Component\HttpFoundation\Response
  22.     */
  23.     public function login(Request $requestUserPasswordHasherInterface $passwordHasherAuthenticationUtils $authenticationUtils)
  24.     {
  25.         
  26.         $error '';
  27.         $lastUsername '';
  28.             
  29.             $error $authenticationUtils->getLastAuthenticationError();
  30.             $lastUsername $authenticationUtils->getLastUsername();
  31.             
  32.             
  33.         
  34.         return $this->render('security/login.html.twig', [
  35.             'error' => $error,
  36.             'last_username' => $lastUsername,
  37.         ]);
  38.     }
  39.     
  40.     /**
  41.      * @Route("/check", name="security.check")
  42.      * @return \Symfony\Component\HttpFoundation\Response
  43.     */
  44.     public function check(Request $requestUserPasswordHasherInterface $passwordHasher)
  45.     {
  46.         
  47.         if($request->getMethod() == 'POST'){
  48.             $form->handleRequest($request);
  49.             if($form->isSubmitted()){
  50.                 if($form->isValid()){
  51.                     
  52.                     
  53.                 }
  54.             }
  55.         }
  56.         
  57.         return $this->render('security/login.html.twig', [ 
  58.         ]);
  59.     }
  60.     
  61.     /*
  62.      * @Route("/logout", name="security_logout")
  63.      * @return \Symfony\Component\HttpFoundation\Response
  64.     
  65.     public function logout(Request $request)
  66.     {
  67.         
  68.         
  69.         return $this->render('security/login.html.twig', [ 
  70.         ]);
  71.     }
  72.     */
  73. }