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 login.
10 * If no locale are defined (if user doesn't change it from the login screen), override it with the user's config one.
12 * This can be used by the LocaleListener afterwards.
14 * @see http://symfony.com/doc/master/cookbook/session/locale_sticky_session.html
16 class UserLocaleListener
23 public function __construct(Session
$session)
25 $this->session
= $session;
28 public function onInteractiveLogin(InteractiveLoginEvent
$event)
30 $user = $event->getAuthenticationToken()->getUser();
32 if (null !== $user->getConfig()->getLanguage() && null === $this->session
->get('_locale')) {
33 $this->session
->set('_locale', $user->getConfig()->getLanguage());