Within my cakephp app, I have a Users Table, with fields username, password, and role. The role determines which controllers and actions they can access. 2 types of main roles I have: Admin and Customer. Hence Admins and Customers should only be allowed to access their respective Controllers and Actions.
However under my AppController, it has only a single redirect for non logged in users that leads the same Controller and Action login page, regardless of whether it was a user trying access an admin page or customer page.
I would like to have 2 different login pages, one for Admins and one for Customers. How can I achieve this?
class AppController extends Controller {
public $components = array(
'DebugKit.Toolbar',
'Session',
'Auth'=>array(
'loginRedirect'=>array('controller'=>'Access', 'action'=>'login'),
'logoutRedirect'=>array('controller'=>'Access', 'action'=>'logout'),
'authError'=>'You cannot access that page',
'authorize'=>array('Controller')
)
);
login
toadmin page
instead defaultcustomer page
– walkingRed