當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。