コード例 #1
0
ファイル: OpenIDPlugin.php プロジェクト: Grasia/bolotweet
 /**
  * Handle a POST user credential check in apioauthauthorization.
  * If given an OpenID URL, we'll pass us over to the regular things
  * and then redirect back here on completion.
  *
  * @fixme merge with common code for main OpenID login form
  * @param HTMLOutputter $action
  */
 function onStartOAuthLoginCheck($action, &$user)
 {
     $provider = common_config('openid', 'trusted_provider');
     if ($provider) {
         $openid_url = $provider;
         if (common_config('openid', 'append_username')) {
             $openid_url .= $action->trimmed('openid_username');
         }
     } else {
         $openid_url = $action->trimmed('openid_url');
     }
     if ($openid_url) {
         require_once dirname(__FILE__) . '/openid.php';
         oid_assert_allowed($openid_url);
         $returnto = common_local_url('ApiOauthAuthorize', array(), array('oauth_token' => $action->arg('oauth_token'), 'mode' => $action->arg('mode')));
         common_set_returnto($returnto);
         // This will redirect if functional...
         $result = oid_authenticate($openid_url, 'finishopenidlogin');
         if (is_string($result)) {
             # error message
             throw new ServerException($result);
         } else {
             exit(0);
         }
     }
     return true;
 }