tags:

views:

38

answers:

1

CakePHP's Auth component requires the username field to be present in order to convert the password field into a hash upon save. Apparently, even if I put this in the beforeFilter() - "$this->Auth->fields = array('username' => 'email', 'password' => 'password');" - it doesn't encrypt the password before inserting it into the database. So my question is, assuming this is supposed to happen, what is the best way to encrypt the password? Or, have I made a simple error somewhere?

Thanks in advance for any assistance!

Here's the before filter in the users_controller.php:

    function beforeFilter() {
    $this->Auth->fields = array('username' => 'email', 'password' => 'password');
}

And the app_controller.php:

var $components = array('Auth');
A: 

Oops, I had duplicated the line "$this->Auth->fields = array('username' => 'email', 'password' => 'password');" in the AppController as well and it seems that was causing the problem. Sorry about that and thanks for the tip to double check by posting here :)

Justin