From 8d2944e30fabf8caf4c906935d905267249821ca Mon Sep 17 00:00:00 2001 From: Wim Vandersmissen Date: Thu, 8 Oct 2015 13:41:16 +0200 Subject: [PATCH] fix admin 404 (#169) --- .../AdminBundle/EventListener/PasswordCheckListener.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kunstmaan/AdminBundle/EventListener/PasswordCheckListener.php b/src/Kunstmaan/AdminBundle/EventListener/PasswordCheckListener.php index 71bdfc6644..a885c0608d 100644 --- a/src/Kunstmaan/AdminBundle/EventListener/PasswordCheckListener.php +++ b/src/Kunstmaan/AdminBundle/EventListener/PasswordCheckListener.php @@ -54,11 +54,11 @@ public function __construct(AuthorizationChecker $authorizationChecker, TokenSto public function onKernelRequest(GetResponseEvent $event) { $url = $event->getRequest()->getRequestUri(); - if($this->isAdminRoute($url)) { + if ($this->tokenStorage->getToken() && $this->isAdminRoute($url)) { $route = $event->getRequest()->get('_route'); - if($this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED') && $route != 'fos_user_change_password'){ + if ($this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED') && $route != 'fos_user_change_password') { $user = $this->tokenStorage->getToken()->getUser(); - if($user->isPasswordChanged() == false) { + if ($user->isPasswordChanged() == false) { $response = new RedirectResponse($this->router->generate('fos_user_change_password')); $this->session->getFlashBag()->add('error', 'Your password has not yet been changed'); $event->setResponse($response);