Error with logging in cakephp 2.x

I’m having trouble with authentication for logging in. Whenever I try to login an existing user it flashes my error code.

// App Controller code

// User Model code

// User Controller code

This might be caused by the password is not hashed properly. In your user model, you just validate the input. You should hash the password using the following code.

<?php
App::uses('AppModel', 'Model');
App::uses('BlowfishPasswordHasher', 'Controller/Component/Auth');

class User extends AppModel {

public function beforeSave($options = array()) {
    if (isset($this->data[$this->alias]['password'])) {
        $passwordHasher = new BlowfishPasswordHasher();
        $this->data[$this->alias]['password'] = $passwordHasher->hash(
            $this->data[$this->alias]['password']
        );
    }
    return true;
}

I implemented password hashing, but it’s still not allowing me to login.