本文整理汇总了PHP中Oro\Bundle\UserBundle\Entity\User::getConfirmationToken方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getConfirmationToken方法的具体用法?PHP User::getConfirmationToken怎么用?PHP User::getConfirmationToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\UserBundle\Entity\User
的用法示例。
在下文中一共展示了User::getConfirmationToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmailAsAdminAction
/**
* @Route("/send-email-as-admin/{id}", name="oro_user_reset_send_email_as_admin", requirements={"id"="\d+"})
* @AclAncestor("password_management")
* @Template("OroUserBundle:Reset/widget:sendEmailConfirmation.html.twig")
*/
public function sendEmailAsAdminAction(User $user)
{
$params = ['entity' => $user];
if ($this->getRequest()->isMethod('POST')) {
if (null === $user->getConfirmationToken()) {
$user->setConfirmationToken($user->generateToken());
}
$this->get('session')->set(static::SESSION_EMAIL, $this->getObfuscatedEmail($user));
try {
$this->get('oro_user.mailer.processor')->sendResetPasswordAsAdminEmail($user);
} catch (\Exception $e) {
$params['processed'] = false;
$params['error'] = $this->get('translator')->trans('oro.email.handler.unable_to_send_email');
return $params;
}
$user->setPasswordRequestedAt(new \DateTime('now', new \DateTimeZone('UTC')));
$this->get('oro_user.manager')->updateUser($user);
$params['processed'] = true;
} else {
$params['formAction'] = $this->get('router')->generate('oro_user_reset_send_email_as_admin', ['id' => $user->getId()]);
}
return $params;
}
示例2: testUnserialize
public function testUnserialize()
{
$user = new User();
$serialized = array('password', 'salt', 'username', true, 'confirmation_token', 10);
$user->unserialize(serialize($serialized));
$this->assertEquals($serialized[0], $user->getPassword());
$this->assertEquals($serialized[1], $user->getSalt());
$this->assertEquals($serialized[2], $user->getUsername());
$this->assertEquals($serialized[3], $user->isEnabled());
$this->assertEquals($serialized[4], $user->getConfirmationToken());
$this->assertEquals($serialized[5], $user->getId());
}