mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
hybridAuth debugging improvements.
This commit is contained in:
@@ -1542,11 +1542,13 @@ $social_external = array(
|
||||
"Github" => "https://github.com/settings/applications/new",
|
||||
);
|
||||
|
||||
$testUrl = SITEURL."?route=system/xup/test";
|
||||
|
||||
$text .= "
|
||||
<fieldset class='e-hideme' id='core-prefs-sociallogin'>
|
||||
<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'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
|
@@ -82,20 +82,44 @@ class core_system_xup_controller extends eController
|
||||
|
||||
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']))
|
||||
{
|
||||
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();
|
||||
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 '<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/signup?provider=Facebook').'">Test signup with Facebook</a>';
|
||||
@@ -103,6 +127,8 @@ class core_system_xup_controller extends eController
|
||||
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/signup?provider=Twitter').'">Test signup with Twitter</a>';
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
public function actionEndpoint()
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* 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.
|
||||
@@ -216,7 +216,7 @@ class OAuth2Client
|
||||
|
||||
if( $type == "POST" ){
|
||||
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);
|
||||
|
@@ -862,7 +862,9 @@ class e_user_provider
|
||||
{
|
||||
$this->_config = array(
|
||||
"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"
|
||||
);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user