I'm struggling a bit with this. I have a CakePHP 2.0 application that requires authentication, because it must be in a different language, I left the automatic word "User" with the agreement "Username" and "Password" and made my own database table:
utilizatori('id', 'nume', 'parola')
In my AppController , I have the following definition, which, if I understood correctly, should override CakePHP associations by default and use it in my new structure:
class AppController extends Controller {
var $components = array('Session',
'Auth' => array('Form' => array(
'userModel' => 'Utilizator',
'fields' => array('username' => 'nume', 'password' => 'parola'),
'loginAction' => array('controller' => 'utilizatori', 'action' => 'login'),
'loginRedirect' => array('controller' => 'categorii', 'action' => 'admin_index'))));
function beforeFilter() { }
}
In my UtilizatoriController , I have the following login function:
function login()
{
$this->layout = 'admin';
debug($this->data);
debug(Security::hash($this->data['Utilizator']['parola']));
debug($this->Auth->login());
Debugging the data corresponds to the expected values, let's say:
**data['Utilizator']['nume']** = 'Cosmin'
**data['Utilizator']['parola']** = 'Cosmin'
hash , , false.
, , .
, , $this- > Auth- > login()?