I am using the Auth component and login functionality in my application. But whenever I try to login, it gives me an invalid username and password error.
And it also throws also a warning like:
Warning (2): Invalid argument supplied for foreach() [CORE\Cake\Utility\Hash.php, line 51]
This is my login function:-
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
Any help on this? I don't understand what the problem is. Thanks in advance.
Updated: Here is the code from my AppController.
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'woods', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'add')
)
);