I figured it out,
I was inheriting the Security component from my custom AppController.
It seems if you inherit it that way in your subclass, the auth code
generated differs from the one in the session.
I added Security into my subclassed controller's component list and it
worked fine.
Michael
On Jan 1, 4:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
It seems like I'm over complicating using requireAuth/RequirePost, and
I can't get it to work the way I expect.
I would like to use one action, instead of two, to display the form and
actually save the data.
Here's my code:
function beforeFilter()
{
switch ($this->action)
{
case 'admin_add':
if ($this->data)
{
pr($this->data);
pr($this->Session->read('_Token'));
$this->Security->requireAuth('admin_add');
$this->Security->requirePost('admin_add');
}
break;
}
}
It craps on requireAuth, but requirePost works fine. The key generated
in the form doesn't match the one in the session. I assume thats why it
doesn't work.
Here's the output
Array
(
[_Token] => Array
(
[key] => fc55e5fc21f9c3811957c917adce50c722b97f1d
)
[Zone] => Array
(
[name] => Blah
[comment] => Blah blah
)
)
Array
(
[key] => 777e318608c817c385d09ed1528d1b69322d4c12
[expires] => 1167691891
[allowedControllers] => Array
(
)
[allowedActions] => Array
(
)
)
Please educate me.
Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---