src/Controller/SecurityController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\ForceLogoutService;
  4. use Doctrine\ORM\EntityManager;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  10. class SecurityController extends AbstractController
  11. {
  12.     #[Route(path'/login'name'app_login')]
  13.     public function login(AuthenticationUtils $authenticationUtils): Response
  14.     {
  15.         // if ($this->getUser()) {
  16.         //     return $this->redirectToRoute('target_path');
  17.         // }
  18.         // get the login error if there is one
  19.         $error $authenticationUtils->getLastAuthenticationError();
  20.         // dd(password_hash("test@#25",PASSWORD_DEFAULT)) ;
  21.         // if(!empty($error))
  22.         // {
  23.         //     dd($error) ;
  24.         // }
  25.         // last username entered by the user
  26.         $lastUsername $authenticationUtils->getLastUsername();
  27.         return $this->render('security/loginPage.html.twig', ['last_username' => $lastUsername'error' => $error]);
  28.     }
  29.     #[Route(path'/auth/login'name'auth_login')]
  30.     public function authentificationLogin()
  31.     {
  32.         // return $this->redirectToRoute("");
  33.     }
  34.     #[Route('/logout'name'security_logout')]
  35.     public function logout(ForceLogoutService $forceLogoutService)
  36.     {
  37.         // $forceLogoutService->logout();
  38.         // $response = $this->redirectToRoute('app_login');
  39.         // $response->headers->clearCookie('PHPSESSID');
  40.         // return $response;
  41.     }
  42. }