My Ajax functions are in different controllers but I added
function beforeFilter()
{
parent::beforeFilter();
if ($this->params['action'] == 'update_systems')
{
$this->Security->validatePost = false;
}
}
but when I submit the form I debug this->data and still see
Array
(
[_Token] => Array
(
[key] => 405c4e360e9cc6f6df4f3c112c03c7a16b104ddf
[fields] =>
6c5072f719544a7d300fe09d7030e1da27e2652b%3An%3A0%3A%7B%7D
)
And the updated data is not saved
Ideas?
Thanks,
Dave
-----Original Message-----
From: Miles J [mailto:[email protected]]
Sent: June-02-09 10:51 PM
To: CakePHP
Subject: Re: Security Component and AJAX
Security component does not work in conjunction with Ajax.
If all your ajax requests are in a controller called Ajax, simply place this
in the beforeFilter().
/**
* Executed before each action
*/
function beforeFilter() {
parent::beforeFilter();
// Turn debug off for ajax calls
Configure::write('debug', 0);
// Security
$this->Security->validatePost = false;
// Not ajax
if (!$this->RequestHandler->isAjax()) {
$this->Security->blackHole($this, 'You are not authorized to process
this request!');
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---