How can I make the Auth component of cakephp create, use and store a random salt with the password?
A:
There is no such functionality in Auth component. Take a look at Random String generator CakePHP component.
bancer
2010-06-18 00:45:08
+2
A:
You can start here http://book.cakephp.org/view/566/Change-Hash-Function , and set the $authenticate
variable to your user model:
class User extends AppModel {
function hashPasswords($data) {
if (isset($data['User']['password'])) {
//Get the user to get the salt
$user = $this->findByUsername($data['User']['username']);
//Let's say you have a "salt" field in your db
$data['User']['password'] = md5($data['User']['password'].$user['User']['salt']);
return $data;
}
return $data;
}
}
Gian Basagre
2010-06-18 02:22:26