本文整理汇总了PHP中Oro\Bundle\UserBundle\Entity\User::setConfirmationToken方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setConfirmationToken方法的具体用法?PHP User::setConfirmationToken怎么用?PHP User::setConfirmationToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\UserBundle\Entity\User
的用法示例。
在下文中一共展示了User::setConfirmationToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConfirmationToken
public function testConfirmationToken()
{
$user = new User();
$token = $user->generateToken();
$this->assertNotEmpty($token);
$user->setConfirmationToken($token);
$this->assertEquals($token, $user->getConfirmationToken());
}
示例2: 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;
}