Hi all, I'm new here and in the process of building my first CakePHP app, using a recently upgraded 2.3.5 > 2.4.0-RC2.
-- I've managed to get the new BlowfishPasswordHasher working with my User model beforeSave() function, and can verify in the database that users are created with a blowfish hash in the password field. My issue is that the User model's login function is failing when trying to log in with the correct credentials.
Here is my $components variable from AppController:
public $components = array(
'Session',
'Security',
'Cookie',
'DebugKit.Toolbar',
'Auth' => array(
'loginAction' => array(
'controller' => 'users',
'action' => 'login'
),
'authError' => 'You must be logged in to view this page',
'loginError' => 'Invalid username/password combination',
'authenticate' => array(
'Form' => array(
'userModel' => 'User',
'passwordHasher' => 'Blowfish',
),
),
'loginRedirect' => array('controller' => 'DevelopmentPages', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
),
);
This is my beforeSave from the User model:
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;
}
Is there something obvious that I am missing? Any pointers appreciated :)
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment