1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

More XUP fixes

This commit is contained in:
Cameron 2015-01-24 11:16:13 -08:00
parent fa0cbcc72b
commit 277e0c5020
3 changed files with 34 additions and 10 deletions

View File

@ -95,11 +95,22 @@ class core_system_xup_controller extends eController
e107::getUser()->logout();
}
echo 'Logged in: '.(e107::getUser()->isUser() ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$profileData = null;
$provider = e107::getUser()->getProvider();
if($provider) print_a($provider->getUserProfile());
if($provider)
{
$profileData = $provider->getUserProfile();
if(!empty($profileData))
{
print_a($profileData);
}
}
echo 'Logged in: '.(e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
$testUrl = SITEURL."?route=system/xup/test";
$providers = e107::getPref('social_login', array());
@ -109,15 +120,16 @@ class core_system_xup_controller extends eController
if($var['enabled'] == 1)
{
echo '<h3>'.$key.'</h3><ul>';
echo '<li><a href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode($testUrl)).'">Test login only with '.$key.'</a></li>';
echo '<li><a href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode($testUrl)).'">Test signup/login with '.$key.'</a></li>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode($testUrl)).'">Test login only with '.$key.'</a></li>';
echo '<li><a class="btn btn-default" href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode($testUrl)).'">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 class="btn btn-default" href="'.e107::getUrl()->create('system/xup/test?lgt').'">Test logout</a>';
/*
echo '<h3>Facebook</h3>';

View File

@ -342,6 +342,14 @@ class redirection
{
$url = str_replace("&amp;", "&", $url); // cleanup when using e_QUERY in $url;
if(defset('e_DEBUG') == 'redirect')
{
$error = debug_backtrace();
e107::getLog()->addDebug("URL: ".$url."\nFile: ".$error[1]['file']."\nLine: ".$error[1]['line']."\nClass: ".$error[1]['class']."\nFunction: ".$error[1]['function']."\n\n");
e107::getLog()->toFile('redirect.log',true);
}
if(session_id())
{
e107::getSession()->end();

View File

@ -996,7 +996,13 @@ class e_user_provider
if($sql->count("user", "(*)", "user_xup='".$sql->escape($this->userId())."' ".$insert." OR user_loginname='{$userdata['user_loginname']}' OR user_name='{$userdata['user_name']}'"))
{
$this->login($redirectUrl); // auto-login
// $this->login($redirectUrl); // auto-login
e107::getUser()->loginProvider($this->userId());
if($redirectUrl)
{
e107::getRedirect()->redirect($redirectUrl);
}
return;
// throw new Exception( "Signup failed! User already exists. Please use 'login' instead.", 3); // TODO lan
}
@ -1057,9 +1063,7 @@ class e_user_provider
{
e107::getUser()->loginProvider($this->userId()); // if not proper after-login, return true so user can see login screen
}
if($redirectUrl)
{
e107::getRedirect()->redirect($redirectUrl);