";
diff --git a/e107_plugins/social/SocialLoginConfigManager.php b/e107_plugins/social/includes/social_login_config.php
similarity index 98%
rename from e107_plugins/social/SocialLoginConfigManager.php
rename to e107_plugins/social/includes/social_login_config.php
index 0b3ab3b75..6a5b7462f 100644
--- a/e107_plugins/social/SocialLoginConfigManager.php
+++ b/e107_plugins/social/includes/social_login_config.php
@@ -10,7 +10,7 @@
require_once(e_HANDLER . "user_handler.php");
-class SocialLoginConfigManager
+class social_login_config
{
const SOCIAL_LOGIN_PREF = "social_login";
@@ -100,7 +100,7 @@ class SocialLoginConfigManager
* $options['keys']['id'] string The OAuth1 client key or OAuth2 client ID
* $options['keys']['secret'] string The OAuth1 or OAuth2 client secret
* $options['scope'] string OAuth2 scopes, space-delimited
- * @see SocialLoginConfigManager::saveConfig() to commit to database.
+ * @see social_login_config::saveConfig() to commit to database.
*
*/
public function setProviderConfig($providerName, $options)
diff --git a/e107_plugins/social/languages/English/English_admin.php b/e107_plugins/social/languages/English/English_admin.php
index eb363c4ff..19d4e0010 100644
--- a/e107_plugins/social/languages/English/English_admin.php
+++ b/e107_plugins/social/languages/English/English_admin.php
@@ -9,7 +9,7 @@
define("LAN_SOCIAL_ADMIN_00", "Applications");
define("LAN_SOCIAL_ADMIN_01", "Pages");
-define("LAN_SOCIAL_ADMIN_02", "Social Signup/Login"); //tab
+define("LAN_SOCIAL_ADMIN_02", "Configured Login Providers"); //tab
define("LAN_SOCIAL_ADMIN_03", "Signup/Login"); //bar
define("LAN_SOCIAL_ADMIN_04", "Provider");
define("LAN_SOCIAL_ADMIN_05", "Key/ID");
@@ -53,7 +53,7 @@ define("LAN_SOCIAL_ADMIN_42", "Custom Image");
define("LAN_SOCIAL_ADMIN_43","A [database update] is required to continue using this plugin.");
define("LAN_SOCIAL_ADMIN_44", "Add New Provider");
-define("LAN_SOCIAL_ADMIN_45", "These social login providers are currently configured.\nIf the master switch [b]Social Signup/Login[/b] is toggled on, each provider in this table that is also toggled on may be used for user registration and login. If you empty the fields of a provider here and save, it will move to the [b]Add New Providers[/b] section.");
+define("LAN_SOCIAL_ADMIN_45", "These social login providers are currently configured.\nIf the master switch [b]Social Signup/Login[/b] is toggled on, each provider in this table that is also toggled on may be used for user registration and login. If you empty the fields of a provider here and save, it will move to the [b]Add New Provider[/b] section.");
define("LAN_SOCIAL_ADMIN_46", "These are the available social login providers, which have not been configured. Once you configure and save a provider here, it will move to the [b]Configured[/b] section.");
define("LAN_SOCIAL_ADMIN_47", "Broken Configured Providers");
define("LAN_SOCIAL_ADMIN_48", "These social login providers were configured in the past but no longer have an adapter that can support them.[br]This may be due to them no longer existing or being replaced by a different provider.");
@@ -62,6 +62,7 @@ define("LAN_SOCIAL_ADMIN_50", "Enable or disable the social login test page");
define("LAN_SOCIAL_ADMIN_08", "Note: In most cases, you will need to obtain an application ID and secret key from social login providers.\nIf a provider's name is a link, that link should take you to the login application configuration documentation.\n\nYou may test your configuration with the following URL after enabling the [b]Test Page[/b] option:");
define("LAN_SOCIAL_ADMIN_09", "Your callback URL is: ");
+define("LAN_SOCIAL_ADMIN_51", "Social Login System");
diff --git a/e107_plugins/social/social_setup.php b/e107_plugins/social/social_setup.php
index abf229179..2f08e4470 100644
--- a/e107_plugins/social/social_setup.php
+++ b/e107_plugins/social/social_setup.php
@@ -8,7 +8,7 @@
*
*/
-require_once("SocialLoginConfigManager.php");
+require_once("includes/social_login_config.php");
class social_setup
{
@@ -30,8 +30,8 @@ class social_setup
private function upgrade_required_provider_name_normalization()
{
$coreConfig = e107::getConfig();
- $manager = new SocialLoginConfigManager($coreConfig);
- $providerConfig = $coreConfig->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF);
+ $manager = new social_login_config($coreConfig);
+ $providerConfig = $coreConfig->getPref(social_login_config::SOCIAL_LOGIN_PREF);
if (!is_array($providerConfig)) $providerConfig = [];
$normalizedProviderNames = array_keys($providerConfig);
foreach ($normalizedProviderNames as $normalizedProviderName)
@@ -75,9 +75,9 @@ class social_setup
{
$coreConfig = e107::getConfig();
$logger = e107::getMessage();
- $manager = new SocialLoginConfigManager($coreConfig);
+ $manager = new social_login_config($coreConfig);
- $providerConfig = $coreConfig->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF);
+ $providerConfig = $coreConfig->getPref(social_login_config::SOCIAL_LOGIN_PREF);
if (!is_array($providerConfig)) $providerConfig = [];
foreach ($providerConfig as $oldNormalizedProviderName => $oldOptions)
@@ -107,7 +107,7 @@ class social_setup
{
$manager->setProviderConfig($denormalizedProviderName, $newOptions);
$coreConfig->removePref(
- SocialLoginConfigManager::SOCIAL_LOGIN_PREF . '/' . $oldNormalizedProviderName
+ social_login_config::SOCIAL_LOGIN_PREF . '/' . $oldNormalizedProviderName
);
$logger->addSuccess(
"Updated name of social login provider $oldNormalizedProviderName → $actualNormalizedProviderName"
diff --git a/e107_tests/tests/unit/plugins/social/SocialLoginConfigManagerTest.php b/e107_tests/tests/unit/plugins/social/SocialLoginConfigManagerTest.php
index b59fb4fc9..369078f4d 100644
--- a/e107_tests/tests/unit/plugins/social/SocialLoginConfigManagerTest.php
+++ b/e107_tests/tests/unit/plugins/social/SocialLoginConfigManagerTest.php
@@ -17,7 +17,7 @@ class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
*/
private $pref;
/**
- * @var SocialLoginConfigManager
+ * @var social_login_config
*/
private $manager;
@@ -26,10 +26,10 @@ class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
*/
public function _before()
{
- include_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
+ include_once(e_PLUGIN . "social/includes/social_login_config.php");
$this->pref = $this->make('e_pref');
- $this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, [
+ $this->pref->set(social_login_config::SOCIAL_LOGIN_PREF, [
'Twitter-OAuth1' => [
'enabled' => true,
'keys' => [
@@ -52,35 +52,35 @@ class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
'enabled' => true,
],
]);
- $this->manager = new SocialLoginConfigManager($this->pref);
+ $this->manager = new social_login_config($this->pref);
}
public function testFlagSettingOff()
{
- $this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_FLAGS, 0x0);
- $this->manager = new SocialLoginConfigManager($this->pref);
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->pref->set(social_login_config::SOCIAL_LOGIN_FLAGS, 0x0);
+ $this->manager = new social_login_config($this->pref);
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
}
public function testFlagSettingGlobalOffPreventsOthersOn()
{
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 0);
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 1);
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_GLOBAL, 0);
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_TEST_PAGE, 1);
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
}
public function testFlagSettingGlobalOnAllowsOtherToggles()
{
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 1);
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 0);
- $this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_GLOBAL, 1);
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_TEST_PAGE, 0);
+ $this->assertTrue($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE, 1);
- $this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_TEST_PAGE, 1);
+ $this->assertTrue($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertTrue($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
}
/**
@@ -89,14 +89,14 @@ class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
*/
public function testFlagGlobalOffTurnsAllOff()
{
- $this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_FLAGS, ~0);
- $this->manager = new SocialLoginConfigManager($this->pref);
- $this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertTrue($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->pref->set(social_login_config::SOCIAL_LOGIN_FLAGS, ~0);
+ $this->manager = new social_login_config($this->pref);
+ $this->assertTrue($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertTrue($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
- $this->manager->setFlag(SocialLoginConfigManager::ENABLE_BIT_GLOBAL, 0);
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_GLOBAL));
- $this->assertFalse($this->manager->isFlagActive(SocialLoginConfigManager::ENABLE_BIT_TEST_PAGE));
+ $this->manager->setFlag(social_login_config::ENABLE_BIT_GLOBAL, 0);
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_GLOBAL));
+ $this->assertFalse($this->manager->isFlagActive(social_login_config::ENABLE_BIT_TEST_PAGE));
}
public function testIsProviderEnabled()
@@ -166,8 +166,8 @@ class SocialLoginConfigManagerTest extends \Codeception\Test\Unit
public function testSetProviderConfigOverwritesNonArray()
{
- $this->pref->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, 'bad string!');
- $manager = new SocialLoginConfigManager($this->pref);
+ $this->pref->set(social_login_config::SOCIAL_LOGIN_PREF, 'bad string!');
+ $manager = new social_login_config($this->pref);
$expected = ['enabled' => true];
$manager->setProviderConfig('FirstProvider', $expected);
diff --git a/e107_tests/tests/unit/plugins/social/social_setupTest.php b/e107_tests/tests/unit/plugins/social/social_setupTest.php
index 374423ded..50c72665d 100644
--- a/e107_tests/tests/unit/plugins/social/social_setupTest.php
+++ b/e107_tests/tests/unit/plugins/social/social_setupTest.php
@@ -12,30 +12,30 @@ class social_setupTest extends \Codeception\Test\Unit
{
public function _before()
{
- include_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
+ include_once(e_PLUGIN . "social/includes/social_login_config.php");
include_once(e_PLUGIN . "social/social_setup.php");
}
public function testUpgradeProviderNameNormalization()
{
- e107::getConfig()->set(SocialLoginConfigManager::SOCIAL_LOGIN_PREF, SOCIAL_LOGIN_LEGACY_DATA);
+ e107::getConfig()->set(social_login_config::SOCIAL_LOGIN_PREF, SOCIAL_LOGIN_LEGACY_DATA);
$social_setup = new social_setup();
$this->assertTrue($social_setup->upgrade_required());
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL"));
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Github"));
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Live"));
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/WindowsLive"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/AOL"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/Github"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/Live"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/WindowsLive"));
$social_setup->upgrade_pre();
$this->assertFalse($social_setup->upgrade_required());
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL"));
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Github"));
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
- $this->assertIsNotArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/Live"));
- $this->assertIsArray(e107::getConfig()->getPref(SocialLoginConfigManager::SOCIAL_LOGIN_PREF . "/WindowsLive-OAuth2"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/AOL"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/AOL-OpenID"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/Github"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/GitHub-OAuth2"));
+ $this->assertIsNotArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/Live"));
+ $this->assertIsArray(e107::getConfig()->getPref(social_login_config::SOCIAL_LOGIN_PREF . "/WindowsLive-OAuth2"));
}
public function testUpgradeFixRenamedProvidersXup()