It's very easy to spoof a user:
$user = $this->User->findByUsername($username);
if ($user):
if ($this->Auth->login($user)):
$this->redirect(array('action' => 'view', 'admin' => false));
endif;
endif;
Jeremy Burns
Class Outfit
[email protected]
http://www.classoutfit.com
On 16 May 2011, at 10:22, [email protected] wrote:
> If you are using roles then you could just have an option to pick a
> different role when you login and save that into the session instead
> of the one stored with your default admin record.
>
>
>
> On May 16, 10:19 am, heohni <[email protected]>
> wrote:
>> Hi,
>>
>> I would like tow rite a function which allows me as admin to login as
>> user using their username and their password.
>> Is something like this possible? I have seen such a function is some
>> CMS and I find it very useful as admin to check out the users view,
>> without the knowing their passwords.
>>
>> Any ideas on that how to do best?
>>
>> Thanks
>> Heidi
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php