Apply firewall security on BaseForm::validateForm

modified:   core/lib/Thelia/Controller/BaseController.php
	modified:   core/lib/Thelia/Form/AddressCreateForm.php
	new file:   core/lib/Thelia/Form/FirewallForm.php
	modified:   core/lib/Thelia/Model/FormFirewall.php
	modified:   setup/insert.sql
This commit is contained in:
lovenunu
2014-07-14 20:58:44 +02:00
committed by Benjamin Perche
parent b42ff568e0
commit 978f15357c
5 changed files with 126 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ use Symfony\Component\Routing\Router;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Core\Translation\Translator;
use Thelia\Form\FirewallForm;
use Thelia\Model\OrderQuery;
use Thelia\Tools\Redirect;
@@ -200,6 +201,14 @@ abstract class BaseController extends ContainerAware
$form->bind($aBaseForm->getRequest());
if ($form->isValid()) {
if ($aBaseForm instanceof FirewallForm && !$aBaseForm->isFirewallOk()) {
throw new FormValidationException(
$this->getTranslator()->trans(
"You have too much sent this form. Please wait before trying again."
)
);
}
return $form;
} else {
$errorMessage = null;