<?php
// Surcharge du securityControlle de FOS_User
// selon https://stackoverflow.com/questions/14475180/multiple-entity-manager-for-fosuserbundle
// et https://symfony.com/doc/current/bundles/FOSUserBundle/overriding_controllers.html
namespace App\PaaBundle\Controller;
use FOS\UserBundle\Controller\SecurityController As BaseController ;
use Symfony\Component\HttpFoundation\Request;
class SecurityController extends BaseController
{
// LG 20221007 début
// public function loginAction(Request $request) {
// return parent::loginAction($request) ;
// }
private $request = null ;
public function loginAction(Request $request) {
$this->request = $request ;
return parent::loginAction($request) ;
}
/**
* Renders the login template with the given parameters. Overwrite this function in
* an extended controller to provide additional data for the login template.
*
* @param array $data
*
* @return Response
*/
protected function renderLogin(array $data) {
// return $this->render('@Paa/Security/Login.html.twig', $data);
if ($this->request->query->has("login")) {
// On a fourni dans l'URL le login par défaut : le transmettre au twig
$login = $this->request->query->get("login") ;
} else {
// On n'a pas fourni dans l'URL le login par défaut
$login = "" ;
}
$data["psLogin"] = $login ;
return $this->render('bundles/FOSUserBundle/Security/Login.html.twig', $data); // twig situé dans templates/bundles/FOSUserBundle/Security/Login.html.twig
}
// LG 20221007 fin
public function checkLoginAction(Request $request){
echo $JAMAIS_APPELLE ;
$username = \trim($request->request->get("_username"));
$user = $this->container->get('fos_user.user_manager')->findUserByUsername($username);
}
}