On Apr 19, 6:19 am, "Prof. No Time" <libertylivingst...@gmail.com>
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 tells Auth not 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 instructing Auth to 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 that Auth is sending you
somewhere other than pages->display->home? Or that you're seeing an
endless loop? Something else?

Believe me--I know that Auth can be pretty darned confusing.

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 cake-php@googlegroups.com
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?hl=en

Reply via email to