CakePHP 2.0 Auth Login not working

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());
    /*more here but don't think it important*/

Debugging the data corresponds to the expected values, let's say:

**data['Utilizator']['nume']** = 'Cosmin'
**data['Utilizator']['parola']** = 'Cosmin'

hash , , false.

, , . , , $this- > Auth- > login()?

0
1

, $this- > Auth- > login() AuthComponent AppController. , Auth CakePHP 2.0.4? , .

, - .

public $components = array(
    'Session',
    'Auth' => array(
        'authenticate' => array(
            'Form' => array(
                'userModel' => 'Utilizator',
                'fields' => array(
                    'username' => 'nume',
                    'password' => 'parola'
                )
            )
        ),
        'loginAction' => array('controller' => 'utilizatori', 'action' => 'login'), //Not related to the problem
        'loginRedirect' => array('controller' => 'utilizatori', 'action' => 'index'), //Not related to the problem
        'logoutRedirect' => array('controller' => 'utilizatori', 'action' => 'index') //Not related to the problem
    )
);
+1

All Articles