Skip to content

Commit 9ad21f1

Browse files
authored
Merge pull request #2923 from pableu/self-salting
Do not create a salt for self-salting password encoders
2 parents 8fdbdd3 + eadb3f0 commit 9ad21f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Util/PasswordUpdater.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use FOS\UserBundle\Model\UserInterface;
1515
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
1616
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
17+
use Symfony\Component\Security\Core\Encoder\SelfSaltingEncoderInterface;
1718

1819
/**
1920
* Class updating the hashed password in the user when there is a new password.
@@ -39,7 +40,7 @@ public function hashPassword(UserInterface $user)
3940

4041
$encoder = $this->encoderFactory->getEncoder($user);
4142

42-
if ($encoder instanceof BCryptPasswordEncoder) {
43+
if ($encoder instanceof BCryptPasswordEncoder || $encoder instanceof SelfSaltingEncoderInterface) {
4344
$user->setSalt(null);
4445
} else {
4546
$salt = rtrim(str_replace('+', '.', base64_encode(random_bytes(32))), '=');

0 commit comments

Comments
 (0)