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