本文整理汇总了PHP中Token::setUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::setUserId方法的具体用法?PHP Token::setUserId怎么用?PHP Token::setUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::setUserId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createToken
/**
* @param int $userId
* @param string $token
* @return Token
*/
public static function createToken($userId, $token)
{
$newToken = new Token();
$newToken->setUserId($userId);
$newToken->setToken($token);
return $newToken;
}
示例2: createAutologinToken
/**
* @param integer $user_id
* @return Token
*/
public function createAutologinToken($user_id)
{
$token = new Token();
$token->setUserId($user_id);
$token->setAction(Token::$ACTION_AUTOLOGIN);
return $token;
}
示例3: getTokenUserCloud
public function getTokenUserCloud($user, $cloud)
{
$token = new Token();
$token->setUserId($user);
$token->setCloudspaceName($cloud);
try {
$toReturn = current($this->dao->search($token));
} catch (EyeResultNotFoundException $e) {
}
return $toReturn;
}
示例4: executeSendPassword
public function executeSendPassword(sfWebRequest $request)
{
// try to find the user by the given E-Mail-Address
$user = Doctrine::getTable('User')->findOneByEmail($request->getParameter('email'));
if ($user) {
// delete all previous recovery tokens
Doctrine_Query::create()->delete('Token t')->where('t.user_id=? AND action=?', array($user->getId(), Token::$ACTION_RECOVER))->execute();
// generate recover token
$token = new Token();
$token->setUserId($user->getId());
$token->setAction(Token::$ACTION_RECOVER);
$token->save();
// sending user email
$html = $this->getPartial('recoverEmail', array('user' => $user, 'token' => $token));
$subject = sfContext::getInstance()->getI18N()->__('Your TimeHive password');
MailSender::createInstance()->send($user['email'], $subject, $html);
$this->getUser()->setFlash('send_pwd_failure', $this->getContext()->getI18N()->__('An email with instructions to choose a new password has been sent to you.'));
$this->redirect('login/index');
} else {
$this->getUser()->setFlash('send_pwd_failure', $this->getContext()->getI18N()->__('There is no such e-mail address in the our database!'));
$this->redirect('login/index');
}
}