Try configuring it on the $components in AppController:
public $components = array(
'Auth' => array(
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'username')
)
)
)
}
I had the problem on the inverse way, I wanted to validate users with their mail, and not username, and using the above configuration with 'username' => 'email' worked for me.
EDIT:
public $components = array(
'Acl',
'Auth' => array(
'authorize' => array(
'Actions' => array('actionPath' => 'controllers')
),
'authenticate' => array(
'Form' => array(
'fields' => array('username' => 'email')
)
)
),
'Session'
);
public function beforeFilter() {
//User settings
$this->activeUserId = $this->Auth->user;
$this->set('activeuserphoto', $this->Auth->user('photo'));
$this->set('activeusername', $this->Auth->user('username'));
//Configure AuthComponent
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'dashboard');
}