It can certainly be done but by default AuthComponent will redirect
you away from the loginAction if you are already logged in.
Automatically logging in as Miles suggested might go something like:
if ( empty($this->Auth->user()) ) {
$data = array(
$this->Auth->fields['username'] => 'anonymous',
$this->Auth->fields['password'] => 'nopassword'
);
$this->Auth->login($data)
}
But I don't really see the benefit compared to having non-logged in
visitors and logged-in users. When everyone is logged in you would
have to make sure no-one figured out how to change the password of
"anonymous" and you would really have to be careful with permissions.
Why do you like this approach?
/Martin
On Jan 18, 12:13 am, Robert <[email protected]> wrote:
> "Also how would an anonymous login to another user account, if the
> system always logs him in as anonymous? "
>
> After getting data from the login page I will change user data saved
> in session... I did thing like this in .net, I am not sure It is
> possible with cake Auth, but it is quite versatile :)
>
> I will check the login method.
>
> thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---