本文整理匯總了PHP中Token::isExpired方法的典型用法代碼示例。如果您正苦於以下問題:PHP Token::isExpired方法的具體用法?PHP Token::isExpired怎麽用?PHP Token::isExpired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Token
的用法示例。
在下文中一共展示了Token::isExpired方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIsExpired
public function testIsExpired()
{
$token = new Token(array('access_token' => '', 'refresh_token' => '', 'expires_in' => 5));
$this->assertFalse($token->isExpired());
$token = new Token(array('access_token' => '', 'refresh_token' => '', 'expires_in' => -5));
$this->assertTrue($token->isExpired());
}
示例2:
<?php
/**
*
*/
//STATUS: works (???)
//TODO: use js from views/core/js_validation.php to check password
//XXX use XhtmlForm?
namespace cd;
if (!$this->token) {
return;
}
$duration = ForgotPasswordHandler::getInstance()->getExpireTime();
if (Token::isExpired('activation_code', $this->token, $duration)) {
echo 'The token is no longer valid.';
return;
}
$user_id = Token::getOwner('activation_code', $this->token);
if (!$user_id) {
throw new \Exception('token dont exist');
}
if ($session->id && $user_id != $session->id) {
throw new \Exception('HACKER stop doing that!');
}
if ($session->id) {
echo '<div class="critical">You are already logged in! Are you sure you want to reset your password?</div>';
}
if (isset($_POST['reset_pwd']) && isset($_POST['reset_pwd2'])) {
/// TODO reuse code from register user
if ($_POST['reset_pwd'] == $_POST['reset_pwd2']) {