src/Controller/Administration/SecurityController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Administration;
  3. use App\Service\LogService;
  4. use App\Entity\Main\Administration\Logs;
  5. use App\Entity\Main\Administration\Users;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  10. class SecurityController extends AbstractController
  11. {
  12.     /**
  13.      * Page de connexion
  14.      * 
  15.      * @Route("/login", name="login")
  16.      * @param Request $request
  17.      * @param AuthenticationUtils $authenticationUtils
  18.      * @return Response
  19.      */
  20.     public function login(Request $requestAuthenticationUtils $authenticationUtils)
  21.     {
  22.         // get the login error if there is one
  23.         $error $authenticationUtils->getLastAuthenticationError();
  24.         // last username entered by the user
  25.         $lastUsername $authenticationUtils->getLastUsername();
  26.         return $this->render('security/login.html.twig', array(
  27.             'last_username' => $lastUsername,
  28.             'error' => $error,
  29.         ));
  30.     }
  31.     /**
  32.      * Page de redirection après la connexion de l'utilisateur sur le BackOffice
  33.      * 
  34.      * @Route("/login/first", name="loginfirst")
  35.      * 
  36.      * @param LogService $logService
  37.      * @return Response
  38.      */
  39.     public function test_log(LogService $logService)
  40.     {
  41.         $log $logService->setLog("L'Utilisateur vient de se connecter sur le BackOffice");
  42.         return $this->redirectToRoute("index");
  43.     }
  44. }