1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

hybridAuth debugging improvements.

This commit is contained in:
Cameron
2015-01-24 02:22:00 -08:00
parent 6a2c29de5e
commit 04f92e5335
4 changed files with 66 additions and 36 deletions

View File

@@ -1542,11 +1542,13 @@ $social_external = array(
"Github" => "https://github.com/settings/applications/new", "Github" => "https://github.com/settings/applications/new",
); );
$testUrl = SITEURL."?route=system/xup/test";
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-sociallogin'> <fieldset class='e-hideme' id='core-prefs-sociallogin'>
<legend>Social Options</legend> <legend>Social Options</legend>
<div class='alert alert-warning'>Note: This section requires further testing</div> <div class='alert alert-warning'>Note: This section requires further testing.<br />You may test with the following URL:
<a href='".$testUrl."' rel='external'>".$testUrl."</a></div>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />

View File

@@ -82,20 +82,44 @@ class core_system_xup_controller extends eController
public function actionTest() public function actionTest()
{ {
echo 'Login controller<br /><br />'; echo '<h3>Social Login Tester</h3>';
if(getperms('0'))
{
echo e107::getMessage()->addError("Please logout of e107 before testing the new-user login/signup procedure.")->render();
return;
}
if(isset($_GET['lgt'])) if(isset($_GET['lgt']))
{ {
e107::getUser()->logout(); e107::getUser()->logout();
} }
echo 'Logged in: '.(e107::getUser()->isUser() ? 'true' : 'false'); echo 'Logged in: '.(e107::getUser()->isUser() ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$provider = e107::getUser()->getProvider(); $provider = e107::getUser()->getProvider();
if($provider) print_a($provider->getUserProfile()); if($provider) print_a($provider->getUserProfile());
$providers = e107::getPref('social_login', array());
foreach($providers as $key=>$var)
{
if($var['enabled'] == 1)
{
echo '<h3>'.$key.'</h3><ul>';
echo '<li><a href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode(e_REQUEST_URL)).'">Test login only with '.$key.'</a></li>';
echo '<li><a href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode(e_REQUEST_URL)).'">Test signup/login with '.$key.'</a></li>';
echo "</ul>";
}
// print_a($var);
}
echo '<br /><br /><a href="'.e107::getUrl()->create('system/xup/test?lgt').'">Test logout</a>'; echo '<br /><br /><a href="'.e107::getUrl()->create('system/xup/test?lgt').'">Test logout</a>';
/*
echo '<h3>Facebook</h3>'; echo '<h3>Facebook</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Facebook').'">Test login with Facebook</a>'; echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Facebook').'">Test login with Facebook</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Facebook').'">Test signup with Facebook</a>'; echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Facebook').'">Test signup with Facebook</a>';
@@ -103,6 +127,8 @@ class core_system_xup_controller extends eController
echo '<h3>Twitter</h3>'; echo '<h3>Twitter</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Twitter').'">Test login with Twitter</a>'; echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Twitter').'">Test login with Twitter</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Twitter').'">Test signup with Twitter</a>'; echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Twitter').'">Test signup with Twitter</a>';
*/
} }
public function actionEndpoint() public function actionEndpoint()

View File

@@ -2,7 +2,7 @@
/** /**
* HybridAuth * HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth * http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2014, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html * (c) 2009-2015, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/ */
// A service client for the OAuth 2 flow. // A service client for the OAuth 2 flow.
@@ -216,7 +216,7 @@ class OAuth2Client
if( $type == "POST" ){ if( $type == "POST" ){
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
if($params) curl_setopt( $ch, CURLOPT_POSTFIELDS, $params ); if($params) curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($params, '', '&') );
} }
$response = curl_exec($ch); $response = curl_exec($ch);

View File

@@ -862,7 +862,9 @@ class e_user_provider
{ {
$this->_config = array( $this->_config = array(
"base_url" => e107::getUrl()->create('system/xup/endpoint', array(), array('full' => true)), "base_url" => e107::getUrl()->create('system/xup/endpoint', array(), array('full' => true)),
"providers" => e107::getPref('social_login', array()) "providers" => e107::getPref('social_login', array()),
"debug_mode" => 'error',
"debug_file" => e_LOG."hybridAuth.log"
); );
} }