Anthony IVOL Posted June 14, 2017 Share Posted June 14, 2017 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 More sharing options...
Anthony IVOL Posted June 14, 2017 Author Share Posted June 14, 2017 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... 2 Link to comment Share on other sites More sharing options...
Nicronics Posted September 11, 2017 Share Posted September 11, 2017 Thank you very much, you save my day. I searched a while before to find your post. Now it works.I have check if every columns and keys was there but not their size. Migrating from an unworking machine is a pain. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now