Use $session->getFlashBag() instead of deprcated FlashBag service.

This commit is contained in:
Jan Böhmer 2020-05-31 13:48:12 +02:00
parent cd2b3217e1
commit 7f263e9916
3 changed files with 9 additions and 7 deletions

View file

@ -46,7 +46,7 @@ use App\Entity\LogSystem\UserLoginLogEntry;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
use App\Services\LogSystem\EventLogger; use App\Services\LogSystem\EventLogger;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\SecurityEvents; use Symfony\Component\Security\Http\SecurityEvents;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
@ -61,10 +61,10 @@ final class LoginSuccessSubscriber implements EventSubscriberInterface
private $eventLogger; private $eventLogger;
private $gpdr_compliance; private $gpdr_compliance;
public function __construct(TranslatorInterface $translator, FlashBagInterface $flashBag, EventLogger $eventLogger, bool $gpdr_compliance) public function __construct(TranslatorInterface $translator, SessionInterface $session, EventLogger $eventLogger, bool $gpdr_compliance)
{ {
$this->translator = $translator; $this->translator = $translator;
$this->flashBag = $flashBag; $this->flashBag = $session->getFlashBag();
$this->eventLogger = $eventLogger; $this->eventLogger = $eventLogger;
$this->gpdr_compliance = $gpdr_compliance; $this->gpdr_compliance = $gpdr_compliance;
} }

View file

@ -45,6 +45,7 @@ namespace App\EventSubscriber\UserSystem;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@ -77,10 +78,10 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
private $flashBag; private $flashBag;
private $httpUtils; private $httpUtils;
public function __construct(Security $security, FlashBagInterface $flashBag, HttpUtils $httpUtils) public function __construct(Security $security, SessionInterface $session, HttpUtils $httpUtils)
{ {
$this->security = $security; $this->security = $security;
$this->flashBag = $flashBag; $this->flashBag = $session->getFlashBag();
$this->httpUtils = $httpUtils; $this->httpUtils = $httpUtils;
} }

View file

@ -52,6 +52,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
@ -74,12 +75,12 @@ final class RegisterU2FSubscriber implements EventSubscriberInterface
*/ */
private $eventDispatcher; private $eventDispatcher;
public function __construct(UrlGeneratorInterface $router, EntityManagerInterface $entityManager, FlashBagInterface $flashBag, EventDispatcherInterface $eventDispatcher, bool $demo_mode) public function __construct(UrlGeneratorInterface $router, EntityManagerInterface $entityManager, SessionInterface $session, EventDispatcherInterface $eventDispatcher, bool $demo_mode)
{ {
$this->router = $router; $this->router = $router;
$this->em = $entityManager; $this->em = $entityManager;
$this->demo_mode = $demo_mode; $this->demo_mode = $demo_mode;
$this->flashBag = $flashBag; $this->flashBag = $session->getFlashBag();
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
} }