Don't do a redirect; place this in your app_controller beforeFilter:

$this->Auth->autoRedirect = false;

Then add the code in your users->login method to populate the Auth.User session 
key and then redirect accordingly.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 9 Dec 2011, at 18:44:50, RhythmicDevil wrote:

> Ok thats fair enough. I can do a redirect, get the Group and then
> redirect to the final destination. Actually that allows me to also get
> a default path per group too.
> 
> thanks
> 
> 
> On Dec 9, 1:39 pm, Jeremy Burns | Class Outfit
> <jeremybu...@classoutfit.com> wrote:
>> Look at the autoRedirect property of the Auth component. It allows you to 
>> perform logic after login but before redirect - perfect for what you need.
>> 
>> http://book.cakephp.org/view/1265/AuthComponent-Variables#autoRedirec...
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> http://www.classoutfit.com
>> 
>> On 9 Dec 2011, at 18:20:22, RhythmicDevil wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>>> I have Users and Groups. When a user logs in I want the group name to
>>> be part of the record that is stored in Session. Currently I get this:
>> 
>>> array (
>>>    'id' => '4',
>>>    'username' => 'swright',
>>>    'group_id' => '4',
>>>    'created' => '2011-12-05 11:36:30',
>>>    'modified' => '2011-12-05 11:36:30',
>>> )
>> 
>>> What I want is this:
>> 
>>> array (
>>>    'id' => '4',
>>>    'username' => 'swright',
>>>    'group_id' => '4',
>>>    'group' => 'administrators',
>>>    'created' => '2011-12-05 11:36:30',
>>>    'modified' => '2011-12-05 11:36:30',
>>> )
>> 
>>> I figured I could just fetch the group name in the login method after
>>> the user is logged in. However my login method never gets called when
>>> I submit the data. But the user is logged in and redirected to the
>>> appropriate controller/action. The method is called when the login
>>> page is first requested but upon submission of the form it does not
>>> seem to get called again.
>> 
>>> So I poked around the Auth component but the login function does not
>>> contain and sort of redirect that I could see. I am using Acl and Auth
>>> so this probably has something to do with it.
>> 
>>> Can you explain the execution chain for logging in a user when using
>>> Acl and Auth?
>> 
>>> I think there's probably also a way to do it automatically by defining
>>> something in the User model but I am not sure.
>> 
>>> Thanks.
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to