Rotate Cakephp Auth Password Hash

I am updating the cakephp application on my new assignment from l.1 to 1.2. I am replacing the authorization code 1.1 with the original Auth component. The problem is that passwords are not hashed in an obsolete database. How to temporarily disable password hashing so that I can start using the Auth component.

Do not worry, I will use the passwords and change this later.

+3
source share
2 answers

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

How to replace 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;
    }
}
?>
+4
source

, . !

UPDATE user_table SET password = SHA1(password)

CakePHP - SHA-1, , , . SHA1 - MySQL, , .

0

Source: https://habr.com/ru/post/1725499/


All Articles