Skip to content

Commit

Permalink
PS-613: reverted BCryptPasswordEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
matweew committed May 11, 2018
1 parent 534a445 commit bf8a81d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Spryker/Zed/Customer/Business/Customer/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
use Spryker\Zed\Customer\Dependency\Facade\CustomerToMailInterface;
use Spryker\Zed\Customer\Persistence\CustomerQueryContainerInterface;
use Spryker\Zed\Locale\Persistence\LocaleQueryContainerInterface;
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;

class Customer implements CustomerInterface
{
protected const BCRYPT_FACTOR = 12;
protected const BCRYPT_SALT = '';

/**
* @var \Spryker\Zed\Customer\Persistence\CustomerQueryContainerInterface
Expand Down Expand Up @@ -739,11 +741,9 @@ protected function encryptNewPassword(CustomerTransfer $customerTransfer)
*/
protected function getEncodedPassword($currentPassword)
{
$options = [
'cost' => static::BCRYPT_FACTOR,
];
$encoder = new BCryptPasswordEncoder(self::BCRYPT_FACTOR);

return password_hash($currentPassword, PASSWORD_BCRYPT, $options);
return $encoder->encodePassword($currentPassword, self::BCRYPT_SALT);
}

/**
Expand All @@ -754,7 +754,9 @@ protected function getEncodedPassword($currentPassword)
*/
protected function isValidPassword($hash, $rawPassword)
{
return password_verify($rawPassword, $hash);
$encoder = new BCryptPasswordEncoder(self::BCRYPT_FACTOR);

return $encoder->isPasswordValid($hash, $rawPassword, self::BCRYPT_SALT);
}

/**
Expand Down

0 comments on commit bf8a81d

Please sign in to comment.