本文整理汇总了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==');
}