CakePHP auth Pluggin Redirect Problem

I am using the cakephp auth plugin. After logging in, what happens. The default login page is set by defining the loginAction variable in the beforeFilter function in your UserController or AppController. But if you use plugins in your application, and if the user tries to access the action of the plug-in controller, the user is redirected to an invalid page like this.

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

BeforeFilter functionality is similar to 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'); 

}

+4
source share
1 answer
 $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.

+5
source

Source: https://habr.com/ru/post/1395462/


All Articles