X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/eb6674f160d9c9bf4a2dd4daf6b9e48b125de2e7..4e8999b2a4223a10501104ec3373834b7c1cc404:/Repository/UserRepository.php?ds=sidebyside diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index d75e229..db4d84e 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -13,11 +13,15 @@ namespace Rapsys\UserBundle\Repository; use Doctrine\ORM\Query\ResultSetMapping; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; +use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; + +use Rapsys\UserBundle\Repository; /** * UserRepository */ -class UserRepository extends EntityRepository { +class UserRepository extends Repository implements PasswordUpgraderInterface { /** * Find user count as int * @@ -142,4 +146,15 @@ SQL; //Send result return $ret; } + + /** + * {@inheritdoc} + */ + public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $hash): void { + //Set new hashed password + $user->setPassword($hash); + + //Flush data to database + $this->getEntityManager()->flush(); + } }