1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-10 16:46:50 +02:00

New API to detect if social login is enabled site-wide

The site-wide social login system is now backwards-compatible with how
the social_login_active core pref worked since commit
3b2d8333b6.

social_login_active's least significant bit is now treated as a global
bit, so if it's not set, no other bits are allowed to be set. This
un-breaks all existing checks for whether social_login_active is empty.

Except in themes, the social_login_active check has been replaced with
an e_user_provider API to check if social login is enabled site-wide.
This commit is contained in:
Nick Liu
2020-02-22 23:55:20 +01:00
parent 616add5c93
commit 379a963902
10 changed files with 110 additions and 18 deletions

View File

@@ -1609,7 +1609,7 @@ class e_user extends e_user_model
*/
final public function loginProvider($xup)
{
if(!e107::getPref('social_login_active', false)) return false;
if(!e107::getUserProvider()->isSocialLoginEnabled()) return false;
if($this->isUser()) return true;
@@ -1724,7 +1724,7 @@ class e_user extends e_user_model
public function tryProviderSession($deniedAs)
{
// don't allow if main admin browse front-end or there is already user session
if((!$deniedAs && $this->getSessionDataAs()) || null !== $this->_session_data || !e107::getPref('social_login_active', false)) return $this;
if((!$deniedAs && $this->getSessionDataAs()) || null !== $this->_session_data || !e107::getUserProvider()->isSocialLoginEnabled()) return $this;
$hybrid = e107::getHybridAuth(); // init the auth class
@@ -1883,7 +1883,7 @@ class e_user extends e_user_model
$this->_initConstants();
// init any available external user provider
if(e107::getPref('social_login_active', false)) $this->initProvider();
if(e107::getUserProvider()->isSocialLoginEnabled()) $this->initProvider();
return $this;
}