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 the following 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 i开发者_开发技巧n the users_controller.php:
function beforeFilter() {
$this->Auth->fields = array('username' => 'email', 'password' => 'password');
}
And the app_controller.php:
var $components = array('Auth');
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 :)
精彩评论