本文整理匯總了PHP中Sylius\Component\User\Model\UserInterface::getPlainPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserInterface::getPlainPassword方法的具體用法?PHP UserInterface::getPlainPassword怎麽用?PHP UserInterface::getPlainPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sylius\Component\User\Model\UserInterface
的用法示例。
在下文中一共展示了UserInterface::getPlainPassword方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updatePassword
/**
* {@inheritDoc}
*/
public function updatePassword(UserInterface $user)
{
if (0 !== strlen($password = $user->getPlainPassword())) {
$user->setPassword($this->userPasswordEncoder->encode($user));
$user->eraseCredentials();
}
}
示例2: updatePassword
/**
* {@inheritDoc}
*/
public function updatePassword(UserInterface $user)
{
if (0 !== strlen($password = $user->getPlainPassword())) {
$encoder = $this->encoderFactory->getEncoder($user);
$user->setPassword($encoder->encodePassword($password, $user->getSalt()));
$user->eraseCredentials();
}
}
示例3:
function it_does_nothing_if_plain_password_is_empty(UserPasswordEncoderInterface $userPasswordEncoder, UserInterface $user)
{
$user->getPlainPassword()->willReturn('');
$userPasswordEncoder->encode($user)->willReturn('topSecretEncodedPassword');
$user->setPassword(Argument::any())->shouldNotBeCalled();
$user->eraseCredentials()->shouldNotBeCalled();
$this->updatePassword($user);
}
示例4:
function it_encodes_password(EncoderFactoryInterface $encoderFactory, PasswordEncoderInterface $passwordEncoder, UserInterface $user)
{
$user->getPlainPassword()->willReturn('topSecretPlainPassword');
$user->getSalt()->willReturn('typicalSalt');
$encoderFactory->getEncoder($user)->willReturn($passwordEncoder);
$passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
$this->encode($user)->shouldReturn('topSecretEncodedPassword');
}
示例5: it_does_nothing_if_plain_password_is_empty
public function it_does_nothing_if_plain_password_is_empty($encoderFactory, PasswordEncoderInterface $encoder, UserInterface $user)
{
$user->getPlainPassword()->willReturn('');
$user->getSalt()->willReturn('typicalSalt');
$encoderFactory->getEncoder($user)->shouldNotBeCalled();
$encoder->encodePassword('', 'typicalSalt')->shouldNotBeCalled();
$user->setPassword(Argument::any())->shouldNotBeCalled();
$user->eraseCredentials()->shouldNotBeCalled();
$this->updatePassword($user);
}
示例6: updateUserPassword
/**
* @param UserInterface $user
*/
public function updateUserPassword(UserInterface $user)
{
if (null !== $user->getPlainPassword()) {
$this->passwordUpdater->updatePassword($user);
}
}
示例7: encode
/**
* {@inheritdoc}
*
* @throws \LogicException when the algorithm is not supported
*/
public function encode(UserInterface $user)
{
return $this->encodePassword($user->getPlainPassword(), $user->getSalt());
}
示例8:
function it_encodes_password(UserInterface $user)
{
$user->getPlainPassword()->willReturn('myPassword');
$user->getSalt()->willReturn('typicalSalt');
$this->encode($user)->shouldReturn('G1DuArwJiu+4Ctk9p2965gC3SXjGcom6gNhmV0OGUm79Kb9Anm5GWg==');
}