I woud set $this->Auth->loginRedirect to false and check in the login
() action if the user is logged or not. This way you can check a lot
more things (user role, etc.) and redirect the logged user wherever
you want. Oh, and one more thing, disable the browser cache for the
login form...

On Mar 31, 3:41 pm, John Andersen <[email protected]> wrote:
> In your case I would change your route "/" as I specified earlier and
> in the app_controller->beforeFilter function, add:
>
>       $this->Auth->loginRedirect = array('controller' => 'foo',
> 'action' => 'index');
>
> Thus when a user provides a valid login, the user is automatically
> directed to "/foo/index"
> Enjoy,
>    John
>
> On Mar 31, 3:13 pm, iFeghali <[email protected]> wrote:
>
>
>
> > Hello All,
>
> > Many thanks for the help so far. Let's try to be a bit more clear...
> > that's my scenario:
>
> > 1) only authenticated users have access to the site (but the login
> > form, of course)
>
> > for a visitor (non auth user):
> > 2) example.com should redirect to example.com/users/login with no
> > error message at all
> > 3) example.com/anything should redirect to example.com/users/login
> > with no error message at all, and them redirect the user to /anything
> > after logging in
> > 4) providing the wrong credentials should pop up an error message
>
> > for an authenticated user:
> > 5) example.com should redirect to example.com/foo/index
> > 6) trying to access a resource denied to this user should get him the
> > "authError" (but no login form, clear now burzum?)
>
> > So far I have 1, 3, 4, 5 and 6 working fine. But I couldn't think of a
> > way to implement (2) without breaking one of the others. Currently
> > "root" (/) routes to /foo/index and I would prefer to keep it this
> > way. Routing "/" to /users/login would bring (2) but break (5).
> > Routing "/" to /users/login *and* finding a way to redirect the path
> > to /foo/index inside the users controller sounds an ugly hack that i
> > would like to avoid. Any more ideas left ?
>
> > Thank you.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to