Jump to content

Customer can't login just after creating an account PS 1.7


Recommended Posts

Hi,

 

I have an issue with customer login.

No problem to create an account but after logout customers can't login again.

 

If I force the hash method to md5 like this in /src/Core/Crypto in "hash" method :

    public function hash($plaintextPassword, $staticSalt = _COOKIE_KEY_)
    {
        if (!count($this->hashMethods)) {
            $this->initHashMethods();
        }

        //$closure = reset($this->hashMethods);
        // changed with the following :
        $closure = $this->hashMethods['md5'];

        return $closure['hash']($plaintextPassword, $staticSalt, $closure['option']);
    }

That works and customer can create an account, login, logout, and login again.

So the problem maybe comes from bcrypt the other used hashing method : 

$this->hashMethods = array(
            'bcrypt' => array(
                'option' => array(),
                'hash' => function ($passwd, $staticSalt, $option) {
                    return password_hash($passwd, PASSWORD_BCRYPT);
                },
                'verify' => function ($passwd, $hash, $staticSalt) {
                    return password_verify($passwd, $hash);
                },
            ),
            'md5' => array(
                'option' => array(),
                'hash' => function ($passwd, $staticSalt, $option) {
                    return md5($staticSalt.$passwd);
                },
                'verify' => function ($passwd, $hash, $staticSalt) {
                    return md5($staticSalt.$passwd) === $hash;
                },
            ),
        );

The hash method of bcrypt works as customers can create an account, and hash is saved in database.

 

But the the 'password_verify' method doesn't and return false all the time.

 

 

The weird thing is that I am working on another PS 1.7.1 and on this other one that works....

So the problem maybe comes from server setup. 

I moved both on my local computer with mamp, and same problem.

 

 

So..., anyone have an idea on what is going wrong ?

 

 

Thanks

 

 

 

 

Link to comment
Share on other sites

  • 2 months later...
  • 4 years later...
On 6/14/2017 at 10:03 PM, Anthony IVOL said:

If it could help someone,

 

I have imported ps_customer table from an older PS version, I missed that the length of the passwd column was 32 and should be 60.

The hash was crop at save...

Thank very much;

 

This solve my problem too.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...