本文整理汇总了PHP中FOS\UserBundle\Model\UserInterface::getPlainPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::getPlainPassword方法的具体用法?PHP UserInterface::getPlainPassword怎么用?PHP UserInterface::getPlainPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOS\UserBundle\Model\UserInterface
的用法示例。
在下文中一共展示了UserInterface::getPlainPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendCreationEmailMessage
/**
* {@inheritdoc}
*/
public function sendCreationEmailMessage(UserInterface $user)
{
$template = $this->parameters['creation.template'];
$url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
$rendered = $this->templating->render($template, array('user' => $user, 'password' => $user->getPlainPassword(), 'confirmationUrl' => $url));
$this->sendEmailMessage($rendered, $this->parameters['from_email']['creation'], $user->getEmail());
}
示例2: updatePassword
/**
* {@inheritdoc}
*/
public function updatePassword(UserInterface $user)
{
if (0 !== strlen($password = $user->getPlainPassword())) {
$passwordDigesta = md5($user->getUsernameCanonical() . ':SabreDAV:' . $password);
$salt = $user->getSalt();
$salted = $password . '{' . $salt . '}';
$digest = hash('sha512', $salted, true);
for ($i = 1; $i < 5000; $i++) {
$digest = hash('sha512', $digest . $salted, true);
}
$encodedPassword = base64_encode($digest);
$user->setPassword($encodedPassword);
$user->setPasswordDigesta($passwordDigesta);
$user->eraseCredentials();
}
}
示例3: updatePassword
/**
* {@inheritDoc}
*/
public function updatePassword(UserInterface $user)
{
if (0 !== strlen($password = $user->getPlainPassword())) {
$encoder = $this->getEncoder($user);
$user->setPassword($encoder->encodePassword($password, $user->getSalt()));
$user->eraseCredentials();
}
}