<?php
namespace App\Controller\Administration;
use App\Service\LogService;
use App\Entity\Main\Administration\Logs;
use App\Entity\Main\Administration\Users;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class SecurityController extends AbstractController
{
/**
* Page de connexion
*
* @Route("/login", name="login")
* @param Request $request
* @param AuthenticationUtils $authenticationUtils
* @return Response
*/
public function login(Request $request, AuthenticationUtils $authenticationUtils)
{
// get the login error if there is one
$error = $authenticationUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/login.html.twig', array(
'last_username' => $lastUsername,
'error' => $error,
));
}
/**
* Page de redirection après la connexion de l'utilisateur sur le BackOffice
*
* @Route("/login/first", name="loginfirst")
*
* @param LogService $logService
* @return Response
*/
public function test_log(LogService $logService)
{
$log = $logService->setLog("L'Utilisateur vient de se connecter sur le BackOffice");
return $this->redirectToRoute("index");
}
}