本文整理匯總了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();
}
}