当前位置: 首页>>代码示例>>PHP>>正文


PHP Token::delete方法代码示例

本文整理汇总了PHP中Token::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::delete方法的具体用法?PHP Token::delete怎么用?PHP Token::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Token的用法示例。


在下文中一共展示了Token::delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: auth

 public function auth()
 {
     $client_id = $this->input->get('clent_id');
     $application = new Application();
     $application->client_id = $client_id;
     $application->get();
     if (!$application->exists()) {
         $data['title'] = 'Auth Page';
         $data['content'] = 'oauth/noapplication';
         $this->load->view('master', $data);
     } elseif (!$this->user_id) {
         $redirect = 'users/login?redirect_url=oauth/auth?client_id=' . $application->id;
         redirect($redirect);
     } elseif ($this->input->post()) {
         $allow = $this->input->post('allow');
         if ($allow) {
             $user = new User($this->user_id);
             $existing_token = new Token();
             $existing_token->where('user_id', $user->id);
             $existing_token->where('application_id', $application->id);
             $existing_token->get();
             if ($existing_token->exists()) {
                 $existing_token->delete();
             }
             $token = $this->generate_token();
             $token->save(array($application, $user));
             die;
             echo 'here';
         }
     } else {
         $this->load->helper('form');
         $data['application'] = array('id' => $application->id, 'name' => $application->name, 'client_id' => $application->client_id, 'client_secret' => $application->client_secret, 'redirect_url' => $application->redirect_url);
         $data['title'] = 'Auth Page';
         $data['content'] = 'oauth/authorize';
         $this->load->view('master', $data);
     }
 }
开发者ID:petersonb,项目名称:ourvigor,代码行数:37,代码来源:oauth.php

示例2: testDelete

 function testDelete()
 {
     $patron_id = 1;
     $menu_id = 2;
     $sender_id = 3;
     $test_token = new Token($patron_id, $menu_id, $sender_id);
     $test_token->save();
     $patron_id2 = 4;
     $menu_id2 = 5;
     $sender_id2 = 6;
     $test_token2 = new Token($patron_id2, $menu_id2, $sender_id2);
     $test_token2->save();
     $test_token->delete();
     $result = Token::getAll();
     $this->assertEquals([$test_token2], $result);
 }
开发者ID:CaseyH33,项目名称:Beer_Me,代码行数:16,代码来源:TokenTest.php

示例3: revoke_token

 /**
  * Revoke specified OAuth token
  *
  * Revokes the authorization token specified by $token_key.
  * Throws exceptions in case of error.
  *
  * @param string $token_key The token to be revoked
  *
  * @access public
  **/
 public function revoke_token($token_key)
 {
     $rt = new Token();
     $rt->tok = $token_key;
     $rt->type = 0;
     $rt->state = 0;
     if (!$rt->find(true)) {
         throw new Exception('Tried to revoke unknown token');
     }
     if (!$rt->delete()) {
         throw new Exception('Failed to delete revoked token');
     }
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:23,代码来源:oauthstore.php

示例4: revoke_token

 /**
  * Revoke specified access token
  *
  * Revokes the token specified by $token_key.
  * Throws exceptions in case of error.
  *
  * @param string $token_key the token to be revoked
  * @param int    $type      type of token (0 = req, 1 = access)
  *
  * @access public
  *
  * @return void
  */
 public function revoke_token($token_key, $type = 0)
 {
     $rt = new Token();
     $rt->tok = $token_key;
     $rt->type = $type;
     $rt->state = 0;
     if (!$rt->find(true)) {
         // TRANS: Exception thrown when an attempt is made to revoke an unknown token.
         throw new Exception(_('Tried to revoke unknown token.'));
     }
     if (!$rt->delete()) {
         // TRANS: Exception thrown when an attempt is made to remove a revoked token.
         throw new Exception(_('Failed to delete revoked token.'));
     }
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:28,代码来源:apignusocialoauthdatastore.php

示例5: Token

 function _deleteTokens()
 {
     $token = new Token();
     $token->consumer_key = $this->consumer_key;
     $token->delete();
 }
开发者ID:himmelex,项目名称:NTW,代码行数:6,代码来源:Consumer.php

示例6: cancel

 /**
  * Cancel a subscription
  *
  */
 function cancel($subscriber, $other)
 {
     if (!self::exists($subscriber, $other)) {
         throw new Exception(_('Not subscribed!'));
     }
     // Don't allow deleting self subs
     if ($subscriber->id == $other->id) {
         throw new Exception(_('Couldn\'t delete self-subscription.'));
     }
     if (Event::handle('StartUnsubscribe', array($subscriber, $other))) {
         $sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id, 'subscribed' => $other->id));
         // note we checked for existence above
         assert(!empty($sub));
         // @todo: move this block to EndSubscribe handler for
         // OMB plugin when it exists.
         if (!empty($sub->token)) {
             $token = new Token();
             $token->tok = $sub->token;
             if ($token->find(true)) {
                 $result = $token->delete();
                 if (!$result) {
                     common_log_db_error($token, 'DELETE', __FILE__);
                     throw new Exception(_('Couldn\'t delete subscription OMB token.'));
                 }
             } else {
                 common_log(LOG_ERR, "Couldn't find credentials with token {$token->tok}");
             }
         }
         $result = $sub->delete();
         if (!$result) {
             common_log_db_error($sub, 'DELETE', __FILE__);
             throw new Exception(_('Couldn\'t delete subscription.'));
         }
         self::blow('user:notices_with_friends:%d', $subscriber->id);
         $subscriber->blowSubscriptionsCount();
         $other->blowSubscribersCount();
         Event::handle('EndUnsubscribe', array($subscriber, $other));
     }
     return;
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:44,代码来源:Subscription.php

示例7: onEndUnsubscribe

 /**
  * Remove old OMB subscription tokens
  *
  * @param User    $user     subscriber
  * @param Profile $other    subscribee
  * @return hook return value
  */
 function onEndUnsubscribe($profile, $other)
 {
     $sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id, 'subscribed' => $other->id));
     if (!empty($sub->token)) {
         $token = new Token();
         $token->tok = $sub->token;
         if ($token->find(true)) {
             $result = $token->delete();
             if (!$result) {
                 common_log_db_error($token, 'DELETE', __FILE__);
                 throw new Exception(_m('Could not delete subscription OMB token.'));
             }
         } else {
             common_log(LOG_ERR, "Couldn't find credentials with token {$token->tok}", __FILE__);
         }
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:25,代码来源:OMBPlugin.php

示例8: delete_update_token

 private function delete_update_token()
 {
     $this->token->delete();
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:UpdateServices.class.php

示例9: logout_post

 /**
  * Account logout
  * @param token
  * @return object{status}
  */
 public function logout_post()
 {
     $response = new stdClass();
     $token_entry = new Token();
     $token_entry->get_by_valid_token($this->post('token'))->get();
     if ($token_entry->exists()) {
         $token_entry->delete();
         $response->status = true;
     } else {
         $response->status = false;
         $response->error = 'Token not found or session expired';
     }
     $this->response($response);
 }
开发者ID:NaszvadiG,项目名称:crono,代码行数:19,代码来源:account.php

示例10: testTokensDelete

 /**
  * @group   ecommerce
  * @group   3dsecure
  * @expectedException         Everypay\Exception\RuntimeException
  * @expectedExceptionMessage  Resource Tokens does not support method Everypay\Token::delete
  */
 public function testTokensDelete()
 {
     //applicable both in local and remote mode
     $token = 'ctn_oLyYPaymB2AozoABZYYHnb3g';
     $payment = Token::delete($token);
 }
开发者ID:everypay,项目名称:everypay-php,代码行数:12,代码来源:TokenTest.php

示例11: xhtmlForm

    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']) {
        UserHandler::setPassword($user_id, $_POST['reset_pwd']);
        $session->login($user->name, $_POST['reset_pwd']);
        echo '<div class="okay">Your password has been reset. You have been logged in.</div>';
        // delete consumed token
        Token::delete($user_id, 'activation_code');
        return;
    } else {
        $error->add('The passwords dont match');
    }
}
echo $error->render(true);
echo 'Reset password for user <b>' . $user->name . '</b>';
$header->registerJsFunction('function validate_reset_pwd_form(frm)' . '{' . 'if (!frm.reset_pwd.value||!frm.reset_pwd2.value)' . 'return false;' . 'return true;' . '}');
//XXXX use XhtmlForm class, it needs a way to show the images first
echo xhtmlForm('reg_frm', '', '', '', 'return validate_reset_pwd_form(this);');
echo '<table cellpadding="2">';
echo '<tr><td>' . t('New password') . ':</td>' . '<td>' . xhtmlPassword('reset_pwd') . ' ' . xhtmlImage($page->getRelativeCoreDevUrl() . 'gfx/icon_keys.png', t('Password')) . '</td>' . '</tr>';
echo '<tr><td>' . t('Again') . ':</td>' . '<td>' . xhtmlPassword('reset_pwd2') . ' ' . xhtmlImage($page->getRelativeCoreDevUrl() . 'gfx/icon_keys.png', t('Repeat password')) . '</td>' . '</tr>';
echo '</table><br/>';
echo xhtmlSubmit('Reset password', 'button', 'font-weight:bold');
开发者ID:martinlindhe,项目名称:core_dev,代码行数:31,代码来源:reset_pwd.php

示例12: testTokensDelete

 /**
  * @expectedException         Everypay\Exception\RuntimeException
  * @expectedExceptionMessage  Resource Tokens does not support method Everypay\Token::delete
  */
 public function testTokensDelete()
 {
     $token = 'ctn_oLyYPaymB2AozoABZYYHnb3g';
     $payment = Token::delete($token);
 }
开发者ID:everypay,项目名称:everypay_prestashop_1_6_x,代码行数:9,代码来源:TokenTest.php


注:本文中的Token::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。