I am using CakePHP and the AuthComponent, and I want each user to have 2 different passwords. My application has 2 login pages, a frontend login and a backend login. I want users to be able to use one password for frontend login, and a different password for backend login.
I was able to setup the pages so that they have the correct forms on the correct pages
echo $this->Form->control('password', ['type'=>'password']);
for the main frontend login, and for the backend login
echo $this->Form->control('backend_password', ['type'=>'password']);
This works in the sence that the correct things are displayed on the correct pages, and I modified my AuthComponent config to this in an attempt to make it work:
$this->loadComponent('Auth', [ // 'allowedActions' 'authError' => 'You are not authorized to access this page.', 'authenticate' => [ 'Form' => [ 'fields' => ['username' => 'email', 'password' => 'password'], 'fields' => ['username' => 'email', 'password' => 'backend_password'] ] ], 'loginRedirect' => [ 'controller' => 'Users', 'action' => 'dashboard' ], 'logoutRedirect' => [ 'controller' => 'Users', 'action' => 'login' ], 'authorize' => 'Controller', 'storage' => 'Session' ]);
but that isn’t working, the above config makes it so you can only login using the backend login page.
I need an AuthComponent config that accepts both for login.
Thanks in advance for any help you can provide!