Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP auth Pluggin redirect issue

I am using cakephp auth Plugin . After login what happening is . The default log-in page is set by defining the loginAction variable in the beforeFilter function in your UsersController or AppController. But if you have used plug-ins in your application, and if a user tries to access a controller action of a plug-in the user is redirected to an invalid page like this.

http://satyam.vakharia.com/plugin_name/users/login

BeforeFilter functionality is like this..

function beforeFilter() {
Security::setHash('md5');
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'home', 'action' => 'index');
$this->Auth->loginError = 'Invalid Username or Password.';
$this->Auth->authError = "You are not authorized to access.";
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');

}

like image 235
NovusMobile Avatar asked Feb 08 '12 18:02

NovusMobile


1 Answers

$this->Auth->loginAction = array('plugin' => false, 'controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('plugin' => false, 'controller' => 'home', 'action' => 'index');
$this->Auth->loginError = 'Invalid Username or Password.';
$this->Auth->authError = "You are not authorized to access.";
$this->Auth->logoutRedirect = array('plugin' => false, 'controller' => 'users', 'action' => 'login');

There.

like image 113
Barry Chapman Avatar answered Nov 09 '22 07:11

Barry Chapman