1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Don't duplicate Hybridauth config in e107::getHybridAuth()

This commit is contained in:
Nick Liu
2020-02-19 16:54:21 +01:00
parent 0bacc5903c
commit a91fa2c9b8
2 changed files with 12 additions and 16 deletions

View File

@@ -1707,7 +1707,8 @@ class e107
* Create a new Hybridauth object based on the provided configuration * Create a new Hybridauth object based on the provided configuration
* *
* @return Hybridauth\Hybridauth * @return Hybridauth\Hybridauth
* @throws \Hybridauth\Exception\InvalidArgumentException * @throws \Hybridauth\Exception\InvalidArgumentException if Hybridauth rejects the provided config
* @throws ReflectionException if this method is unintentionally broken
* @deprecated v2.3.0 Use the e_user_provider interfaces instead (e107::getUser()->getProvider()). * @deprecated v2.3.0 Use the e_user_provider interfaces instead (e107::getUser()->getProvider()).
* Hybridauth features are only available if the user is associated with a social login. * Hybridauth features are only available if the user is associated with a social login.
* @see e107::getUser() for getting a user object that may or may not have a social login. * @see e107::getUser() for getting a user object that may or may not have a social login.
@@ -1715,19 +1716,12 @@ class e107
*/ */
public static function getHybridAuth($config = null) public static function getHybridAuth($config = null)
{ {
if(null === $config) include_once("user_handler.php");
{ $e_user_provider = new e_user_provider(null, $config);
require_once(e_PLUGIN . "social/SocialLoginConfigManager.php"); $reflection = new ReflectionClass('e_user_provider');
$manager = new SocialLoginConfigManager(e107::getConfig()); $reflection_property = $reflection->getProperty('hybridauth');
$reflection_property->setAccessible(true);
$config = array( return $reflection_property->getValue($e_user_provider);
'callback' => self::getUrl()->create('system/xup/login', array(), array('full' => true)),
'providers' => $manager->getValidConfiguredProviderConfigs(),
'debug_mode' => false,
'debug_file' => ''
);
}
return new Hybridauth\Hybridauth($config);
} }
/** /**

View File

@@ -439,13 +439,15 @@ class e107Test extends \Codeception\Test\Unit
$res = null; $res = null;
$this->assertTrue($res); $this->assertTrue($res);
} }
*/
public function testGetHybridAuth() public function testGetHybridAuth()
{ {
$res = null; $object = e107::getHybridAuth();
$this->assertTrue($res); $this->assertInstanceOf(Hybridauth\Hybridauth::class, $object);
} }
/*
public function testGetUserClass() public function testGetUserClass()
{ {
$res = null; $res = null;