I\'m struggling with the concept of creating an admin section in CakePHP-project. (version 2.3.5)
I have uncommented the line in Config/core.php:
Configu
Try This
Your config/routes.php
Router::connect('/', array('controller' => 'users', 'action' => 'dashboard' ));
Appcontroller
class AppController extends Controller {
public $components = array(
'Acl',
'Session',
'Auth' => array(
'authenticate' => array(
'Form' => array(
'userModel' => 'User',
'fields' => array(
'username' => 'user_name',
'password' => 'password'
)
)
),
'loginAction' => array('controller' => 'users', 'action' => 'login'),
'loginRedirect' => array('controller' => 'users', 'action' => 'mysettings'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
'authError' => 'You don\'t have access here.',
/*
'loginAction' => array('controller' => 'users', 'action' => 'forgot_password'),
'loginRedirect' => array('controller' => 'users', 'action' => 'dashboard'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'forgot_password'),
'authError' => 'You don\'t have access here.',
*/
),
);
Usercontroller
class UsersController extends AppController {
/**
* Components
*
* @var array
*/
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('login','logout');
}
}