3 namespace Wallabag\CoreBundle\Event\Listener
;
5 use Symfony\Component\HttpFoundation\Session\Session
;
6 use Symfony\Component\Security\Http\Event\InteractiveLoginEvent
;
9 * Stores the locale of the user in the session after the
10 * login. This can be used by the LocaleListener afterwards.
12 * @see http://symfony.com/doc/master/cookbook/session/locale_sticky_session.html
14 class UserLocaleListener
21 public function __construct(Session
$session)
23 $this->session
= $session;
27 * @param InteractiveLoginEvent $event
29 public function onInteractiveLogin(InteractiveLoginEvent
$event)
31 $user = $event->getAuthenticationToken()->getUser();
33 if (null !== $user->getConfig()->getLanguage()) {
34 $this->session
->set('_locale', $user->getConfig()->getLanguage());