I got it dear. Thanks very much. I opened up the Auth component and
digested it myself (Afterall, its just another component written by a
brother of mine, lol).

I then discovered that the session variable for storing the intended
url is 'Auth.redirect', so I leveraged on it by checking it and
redirecting there if it exists, otherwise, I redirect to my own
default user role page. Its working like breeze!

THANK YOU.

On Apr 19, 12:01 pm, cricket <[email protected]> wrote:
> On Apr 19, 6:19 am, "Prof. No Time" <[email protected]>
> wrote:
>
> > Thanks for the response Cricket, I have dumped my codes below. Please
> > assist me. Regards.
>
> > My AppController::beforeFilter()
>
> > function beforeFilter(){
> >   $this->Auth->fields = array('username' => 'username', 'password' =>
> > 'passkey');
> >   $this->Auth->allow($this->allowedActions);
>
> The above line is unnecessary.
>
> >   $this->Auth->authorize = 'controller';
> >   $this->Auth->loginAction = array('controller' => 'users', 'action'
> > => 'login');
> >   $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
> > => 'display', 'home');
> >   $this->Auth->logoutRedirect = '/';
> >   $this->Auth->autoRedirect = false;
>
> The above line tellsAuthnot to call its own redirect() method, even
> though the redirect var is set.
>
>
>
> > }
>
> > My UsersController::login()
>
> > if ($this->Auth->user()) {
> >     if (!empty($this->data)) {
> >       $this->Session->setFlash('You have been logged in
> > successfully');
> >       $this->_postLoginOperations(); //This method redirects the user
> > based on role
> >       $this->data = array();
> >     }
> >     $this->redirect($this->Auth->redirect());
>
> This is maybe a problem. You're instructingAuthto redirect if
> there's no submitted data. IOW, the first time the login view is
> displayed. That's what it looks like, anyway.
>
> But I can't say more without knowing what _postLoginOperations() does.
>
> When you say it doesn't work, do you mean thatAuthis sending you
> somewhere other than pages->display->home? Or that you're seeing an
> endless loop? Something else?
>
> Believe me--I know thatAuthcan be pretty darned confusing.
>
> Check out the newCakePHPQuestions sitehttp://cakeqs.organd help others with 
> theirCakePHPrelated questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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