Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn of Cakephp Auth password hashing

I am upgrading a cakephp app at my new job from l.1 to 1.2. I am replacing the homegrown 1.1 authorization code with the great Auth component. The problem is that the passwords are not hashed in the legacy DB. How can I turn off the password hashing temporarily so I can start using the Auth component.

Don't worry, I will hash the passwords and change this later.

like image 690
jbrass Avatar asked Dec 11 '25 12:12

jbrass


1 Answers

Here is the solution adapted from another stack overflow answer. By overriding the User::hashPassword model to do nothing basically.

How do I replace the cakephp password hashing algorithm?

<?php
class User extends AppModel {
    var $name = 'User';

    // this is used by the auth component to turn the password into its hash before comparing with the DB
    function hashPasswords($data) {
         return $data;
    }
}
?>
like image 172
jbrass Avatar answered Dec 14 '25 01:12

jbrass



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!