]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Handler/AuthenticationFailureHandler.php
Fix languages and locale set in config default key
[userbundle] / Handler / AuthenticationFailureHandler.php
index d1c2a341e873ae0babb06c3be333afcb7ca99bec..c5d0ec5fd43f7adbf827dee72a2cdc41c4a4ab4e 100644 (file)
@@ -47,7 +47,6 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
         * Config array
         */
        protected array $config;
-       protected array $options;
        protected array $defaultOptions = [
                'failure_path' => null,
                'failure_forward' => false,
@@ -55,36 +54,6 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
                'failure_path_parameter' => '_failure_path',
        ];
 
-       /**
-        * Doctrine instance
-        */
-       protected ManagerRegistry $doctrine;
-
-       /**
-        * MailerInterface
-        */
-       protected MailerInterface $mailer;
-
-       /**
-        * Router instance
-        */
-       protected RouterInterface $router;
-
-       /**
-        * Slugger instance
-        */
-       protected SluggerUtil $slugger;
-
-       /**
-        * RequestStack instance
-        */
-       protected RequestStack $stack;
-
-       /**
-        * Translator instance
-        */
-       protected TranslatorInterface $translator;
-
        /**
         * @xxx Second argument will be replaced by security.firewalls.main.logout.target
         * @see vendor/symfony/security-bundle/DependencyInjection/SecurityExtension.php +360
@@ -103,30 +72,12 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
         *
         * {@inheritdoc}
         */
-       public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options, LoggerInterface $logger, ContainerInterface $container, ManagerRegistry $doctrine, MailerInterface $mailer, RouterInterface $router, SluggerUtil $slugger, RequestStack $stack, TranslatorInterface $translator) {
-               //Set config
-               $this->config = $container->getParameter(self::getAlias());
-
-               //Set doctrine
-               $this->doctrine = $doctrine;
-
-               //Set mailer
-               $this->mailer = $mailer;
-
-               //Set router
-               $this->router = $router;
-
-               //Set slugger
-               $this->slugger = $slugger;
-
-               //Set stack
-               $this->stack = $stack;
-
-               //Set translator
-               $this->translator = $translator;
-
+       public function __construct(protected HttpKernelInterface $httpKernel, protected HttpUtils $httpUtils, protected array $options, protected ?LoggerInterface $logger, protected ContainerInterface $container, protected ManagerRegistry $doctrine, protected MailerInterface $mailer, protected RouterInterface $router, protected SluggerUtil $slugger, protected RequestStack $stack, protected TranslatorInterface $translator) {
                //Call parent constructor
                parent::__construct($httpKernel, $httpUtils, $options, $logger);
+
+               //Set config
+               $this->config = $container->getParameter(self::getAlias());
        }
 
        /**
@@ -233,7 +184,7 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
                        //With not enabled user
                        } elseif ($parent instanceof DisabledException) {
                                //Add error message account is not enabled
-                               $this->addFlash('error', $this->translator->trans('Your account is not enabled'));
+                               $this->addFlash('error', $this->translator->trans('Account not enabled'));
 
                                //Redirect on the same route with sent=1 to cleanup form
                                return new RedirectResponse($this->router->generate($request->get('_route'), $request->get('_route_params')), 302);
@@ -335,10 +286,10 @@ class AuthenticationFailureHandler extends DefaultAuthenticationFailureHandler {
                                }
 
                                //Add notice
-                               $this->addFlash('notice', $this->translator->trans('Your verification mail has been sent, to activate your account you must follow the confirmation link inside'));
+                               $this->addFlash('notice', $this->translator->trans('Your verification mail has been sent, to activate your account follow the confirmation link inside'));
 
                                //Add junk warning
-                               $this->addFlash('warning', $this->translator->trans('If you did not receive a verification mail, check your Spam or Junk mail folders'));
+                               $this->addFlash('warning', $this->translator->trans('If you did not receive a verification mail, check your Spam or Junk mail folder'));
 
                                //Redirect on the same route with sent=1 to cleanup form
                                return new RedirectResponse($this->router->generate($request->get('_route'), $request->get('_route_params')), 302);