Monday, December 1, 2008

Auth->loginAction()

Hi,

I've got a little problem regarding Auth->loginAction() on Cake
1.2.0.7692 RC3.

Auth and ACL is set up and working fine.

By default, Auth redirects to /users/login if someone tries to access a
protected page.
I want to change that. I put the login-form in some sort of sidebar menu
(an element) which is shown on all pages if the user is not logged in.
If a user tries to access a protected page he should not be redirect to
/users/login but to the homepage.

I tried this in beforeFilter in my auth_controller:
$this->Auth->loginAction = array('controller' => 'pages', 'action' =>
'display', 'home');
which does redirect me to the homepage but I cannot login anymore.

By removing the line and adding this:
$this->redirect(array('controller' => 'pages', 'action' => 'display',
'home'));
to the login action in the users controller it works as I want it to.

Is this the cake-way of doing this? Or am I missing something?

Regards
Guenther

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: