Wednesday, July 11, 2012

Bad Redirect with auth component.

Hi Folks,

Please help

I have this code in my AppController


public $components = array('Session','Auth'=> array(

//Error to display when user attempts to access an object or action to which they do not have access.
'authError' => 'You need to login to access the page',
'authorize' => array('controller'),
'loginRedirect'=> array('controller'=>'users','controller'=>'edit' ),
'logoutRedirect'=> array('controller'=>'users','controller'=>'logout' )
)
);

Here are the corresponding functions for login and log out

    public function login() {
    if ($this->request->is('post')){
        if ($this->Auth->login()) {
            $this->redirect($this->Auth->redirect());
        } else {
            $this->Session->setFlash(__('Invalid username or password, try again'));
        }
    }
    }
   
   
    public function logout() {
    $this->Session->setFlash('Good-Bye');
    $this->redirect($this->Auth->logout());

    }

As per my assumption i should be redirected url/users/edit after login and url/users/index after logout, but instead i am redirecting to url/edit and url/index respectively. What seems to be the error? Thanks for your help in advance

--
Best Regards,
Mohit Kumar


--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate