diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index ee23eb8a2..56118635b 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -265,6 +265,11 @@ class BaseController extends ContainerAware return $this->container->getParameter('kernel.debug'); } + protected function accessDenied() + { + throw new AccessDeniedHttpException(); + } + /** * check if the current http request is a XmlHttpRequest. * @@ -273,7 +278,7 @@ class BaseController extends ContainerAware protected function checkXmlHttpRequest() { if(false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) { - throw new AccessDeniedHttpException(); + $this->accessDenied(); } } } diff --git a/core/lib/Thelia/Controller/Front/AddressController.php b/core/lib/Thelia/Controller/Front/AddressController.php index 91f7d1a41..5f3fb4799 100644 --- a/core/lib/Thelia/Controller/Front/AddressController.php +++ b/core/lib/Thelia/Controller/Front/AddressController.php @@ -46,7 +46,13 @@ class AddressController extends BaseFrontController */ public function generateModalAction($address_id) { + if ($this->getSecurityContext()->hasCustomerUser() === false) { + $this->accessDenied(); + } + $this->checkXmlHttpRequest(); + + } /** * Create controller. @@ -57,7 +63,7 @@ class AddressController extends BaseFrontController public function createAction() { if ($this->getSecurityContext()->hasCustomerUser() === false) { - $this->redirect(URL::getInstance()->getIndexPage()); + $this->accessDenied() } $addressCreate = new AddressCreateForm($this->getRequest());