<?php
namespace App\Controller;
use App\Service\ForceLogoutService;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
#[Route(path: '/login', name: 'app_login')]
public function login(AuthenticationUtils $authenticationUtils): Response
{
// if ($this->getUser()) {
// return $this->redirectToRoute('target_path');
// }
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// dd(password_hash("test@#25",PASSWORD_DEFAULT)) ;
// if(!empty($error))
// {
// dd($error) ;
// }
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/loginPage.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
#[Route(path: '/auth/login', name: 'auth_login')]
public function authentificationLogin()
{
// return $this->redirectToRoute("");
}
#[Route('/logout', name: 'security_logout')]
public function logout(ForceLogoutService $forceLogoutService)
{
// $forceLogoutService->logout();
// $response = $this->redirectToRoute('app_login');
// $response->headers->clearCookie('PHPSESSID');
// return $response;
}
}