maj: sémantique, révision vérification ppassword
This commit is contained in:
@ -3,14 +3,25 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class LocaleController extends AbstractController
|
||||
{
|
||||
#[Route(path: 'locale/{locale}', name: 'locale_change')]
|
||||
public function changeLocal(string $locale, Request $request)
|
||||
private ParameterBagInterface $params;
|
||||
|
||||
public function __construct(ParameterBagInterface $params)
|
||||
{
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
#[Route(path: 'locale/{locale?}', name: 'locale_change')]
|
||||
public function changeLocal(?string $locale, Request $request)
|
||||
{
|
||||
if (empty($locale)) {
|
||||
$locale = $this->params->get('default_locale');
|
||||
}
|
||||
// On stocke la langue dans la session
|
||||
$request->getSession()->set('_locale', $locale);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Form\LoginType;
|
||||
use App\Security\PdoUserAuthenticator;
|
||||
use App\Security\SQLLoginUserAuthenticator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\FormError;
|
||||
@ -28,17 +28,17 @@ class SecurityController extends AbstractController
|
||||
$loginForm = $this->createForm(LoginType::class, null);
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
if ($error) {
|
||||
if ($request->getSession()->has(PdoUserAuthenticator::ERROR_LOGIN)) {
|
||||
if ($request->getSession()->has(SQLLoginUserAuthenticator::ERROR_LOGIN)) {
|
||||
$loginForm->get('login')->addError(new FormError($trans->trans('error.login', [], 'messages')));
|
||||
$request->getSession()->remove(PdoUserAuthenticator::ERROR_LOGIN);
|
||||
$request->getSession()->remove(SQLLoginUserAuthenticator::ERROR_LOGIN);
|
||||
}
|
||||
if ($request->getSession()->has(PdoUserAuthenticator::ERROR_PASSWORD)) {
|
||||
if ($request->getSession()->has(SQLLoginUserAuthenticator::ERROR_PASSWORD)) {
|
||||
$loginForm->get('password')->addError(new FormError($trans->trans('error.password', [], 'messages')));
|
||||
$request->getSession()->remove(PdoUserAuthenticator::ERROR_PASSWORD);
|
||||
$request->getSession()->remove(SQLLoginUserAuthenticator::ERROR_PASSWORD);
|
||||
}
|
||||
if ($request->getSession()->has(PdoUserAuthenticator::ERROR_PDO)) {
|
||||
if ($request->getSession()->has(SQLLoginUserAuthenticator::ERROR_PDO)) {
|
||||
$loginForm->addError(new FormError($trans->trans('error.pdo', [], 'messages')));
|
||||
$request->getSession()->remove(PdoUserAuthenticator::ERROR_PDO);
|
||||
$request->getSession()->remove(SQLLoginUserAuthenticator::ERROR_PDO);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user