Here are two ways to disable the CSRF in Symfony 2 Forms:
And while creating the form:
If this has been helpful please donate, thanks!
http://www.craftitonline.com/2011/08/symfony-2-how-to-disable-csrf-on-a-per-form-basis/Development, Software, Hardware, System, Network, API, WebService, Programmation and co..
public function getDefaultOptions(array $options) { return array( 'data_class' => 'Acme\TaskBundle\Entity\Task', 'csrf_protection' => false, // <---- set this to false on a per Form Type basis //'csrf_field_name' => '_token', // a unique key to help generate the secret token //'intention' => 'task_item', ); } |
$form = $this->createFormBuilder($users, array( 'csrf_protection' => false, // <---- set this to false on a per Form Instance basis ))->add(...) ; |
No comments:
Post a Comment