src/Controller/LoginController.php line 19

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use App\Handler\Git;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  10. final class LoginController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/", name="security_login")
  14.      */
  15.     public function loginAction(AuthenticationUtils $authenticationUtilsRequest $requestGit $git): Response
  16.     {
  17.         if ($this->isGranted('ROLE_USER')) {
  18.             return $this->redirectToRoute('dashboard');
  19.         }
  20.         return $this->render(
  21.             'userSecurity/login.html.twig',
  22.             [
  23.                 'last_username' => $authenticationUtils->getLastUsername(),
  24.                 'error' => $authenticationUtils->getLastAuthenticationError(),
  25.                 'sessionIdle' => $request->query->get('session_idle'),
  26.                 'lastCommitDate' => $git->getLastCommitDate()
  27.             ]
  28.         );
  29.     }
  30.     /**
  31.      * @Route("/logout", name="security_logout")
  32.      */
  33.     public function logoutAction(): void
  34.     {
  35.     }
  36. }