removed encoder, set hasher

This commit is contained in:
tracer 2021-06-13 16:20:07 +02:00
parent 84a29f4ae6
commit e273b81925
1 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@ use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use function get_class;
/**
* @method User|null find($id, $lockMode = null, $lockVersion = null)
@ -25,13 +26,13 @@ class UserRepository extends ServiceEntityRepository implements PasswordUpgrader
/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
public function upgradePassword(UserInterface $user, string $newHashedPassword): void
{
if (!$user instanceof User) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
}
$user->setPassword($newEncodedPassword);
$user->setPassword($newHashedPassword);
$this->_em->persist($user);
$this->_em->flush();
}