src/Controller/SecurityController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Utils\LogHelper;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  8. class SecurityController extends AbstractController {
  9.     /**
  10.      * 
  11.      * @param AuthenticationUtils $authenticationUtils
  12.      * @param LogHelper $logHelper
  13.      * @return Response
  14.      */
  15.     public function login(AuthenticationUtils $authenticationUtilsLogHelper $logHelper): Response {
  16.         if ($this->getUser()) {
  17.             return $this->redirect($this->generateUrl('board_dashboard'));
  18.         }
  19.         $error $authenticationUtils->getLastAuthenticationError();
  20.         $lastUsername $authenticationUtils->getLastUsername();
  21.         return $this->render('security/login.html.twig', ['last_username' => $lastUsername'error' => $error]);
  22.     }
  23.     /**
  24.      * @Route("/logout", name="app_logout")
  25.      */
  26.     public function logout() {
  27.         //throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  28.         return $this->redirectToRoute('app_login');
  29.     }
  30. }