add helper checkXmlHttpRequest
This commit is contained in:
@@ -25,6 +25,7 @@ namespace Thelia\Controller;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Exception\InvalidParameterException;
|
||||
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
@@ -263,4 +264,16 @@ class BaseController extends ContainerAware
|
||||
{
|
||||
return $this->container->getParameter('kernel.debug');
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the current http request is a XmlHttpRequest.
|
||||
*
|
||||
* If not, send a
|
||||
*/
|
||||
protected function checkXmlHttpRequest()
|
||||
{
|
||||
if(false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) {
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,15 @@ use Thelia\Tools\URL;
|
||||
class AddressController extends BaseFrontController
|
||||
{
|
||||
|
||||
/**
|
||||
* Controller for generate modal containing update form
|
||||
* Check if request is a XmlHttpRequest and address owner is the current customer
|
||||
* @param $address_id
|
||||
*/
|
||||
public function generateModalAction($address_id)
|
||||
{
|
||||
$this->checkXmlHttpRequest();
|
||||
}
|
||||
/**
|
||||
* Create controller.
|
||||
* Check if customer is logged in
|
||||
|
||||
Reference in New Issue
Block a user