From 10dabf843fa113ba51e279bbb363e580ccce7a3a Mon Sep 17 00:00:00 2001 From: Manoj L Date: Thu, 16 May 2019 15:00:08 +0530 Subject: [PATCH] Issue #19 fix: Scrutinizer fixes --- src/users/jfbconnect.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/users/jfbconnect.php b/src/users/jfbconnect.php index 2cb73ca..1418ff6 100644 --- a/src/users/jfbconnect.php +++ b/src/users/jfbconnect.php @@ -108,7 +108,7 @@ public function post() // If user not found, try registering new user if (!$jUserId) { - $jUserId = $this->jfbRegisterUser($provider, $accessToken); + $jUserId = $this->jfbRegisterUser($provider); } $this->plugin->setResponse($this->generateApiToken($jUserId)); @@ -177,8 +177,6 @@ private function jfbGetProvider($providerName) */ public function jfbGetJoomlaUserId($provider, $accessToken) { - $jUserId = 0; - if (strtolower($provider->name) == 'google') { // Based on: JFB code from components/com_jfbconnect/libraries/provider/google.php -> setupAuthentication() @@ -217,7 +215,6 @@ private function jfbRegisterUser($provider) BaseDatabaseModel::addIncludePath(JPATH_SITE . '/components/com_jfbconnect/models'); $loginRegisterModel = JModelLegacy::getInstance('LoginRegister', 'JFBConnectModel'); $userMapModel = JFBCFactory::usermap(); - $app = JFactory::getApplication(); $providerUserId = $provider->getProviderUserId(); $jUserId = 0; @@ -275,9 +272,11 @@ private function jfbRegisterUser($provider) JFBCFactory::log(JText::_('COM_JFBCONNECT_MSG_USER_REGISTRATION_DISABLED'), 'notice'); // Commmented code below for com_api plugin + // $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); + // return false; - return false; + return 0; } // Check if no mapping, and Automatic Registration is set. If so, auto-create the new user. @@ -298,7 +297,7 @@ private function jfbRegisterUser($provider) /** * Generate API token * - * @param INT $userId user id + * @param int $userId user id * * @return mixed * @@ -318,7 +317,6 @@ private function generateApiToken($userId) } // Init vars - $app = JFactory::getApplication(); $keyModel = new ApiModelKey; $keysModel = new ApiModelKeys; $key = null;