/**
* Check if the user is logged in when requesting an account route, if not
* redirect to the homepage.
*
* @param Event $event
*/
public function checkLoggedIn(KernelEvent $event)
{
$user = $this->get('user.current');
if ($user instanceof AnonymousUser and is_array($event->getRequest()->get('_route_collections')) and in_array('ms.user.account', $event->getRequest()->get('_route_collections'))) {
$event->setResponse(new RedirectResponse('/'));
}
}