本文整理汇总了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']) {