Repository URL to install this package:
|
Version:
6.2.10 ▾
|
<?php
namespace DigitalAscetic\BaseUserBundle\Service;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
class UserPasswordEncoderService
{
const SERVICE_NAME = 'digital_ascetic_base_user.service.password_encoder';
/** @var UserPasswordHasherInterface */
private UserPasswordHasherInterface $userPasswordHasher;
/**
* UserPasswordEncoderService constructor.
* @param UserPasswordHasherInterface $userPasswordEncoder
*/
public function __construct(UserPasswordHasherInterface $userPasswordHasher)
{
$this->userPasswordHasher = $userPasswordHasher;
}
public function encodeUserPassword(PasswordAuthenticatedUserInterface $user, $newPassword): string
{
return $this->userPasswordHasher->hashPassword($user, $newPassword);
}
}