Skip to content

Commit

Permalink
Issue techjoomla#19 fix: Scrutinizer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manojLondhe committed May 16, 2019
1 parent 2a4e538 commit 6eeff8c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/users/jfbconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand All @@ -298,7 +297,7 @@ private function jfbRegisterUser($provider)
/**
* Generate API token
*
* @param INT $userId user id
* @param int $userId user id
*
* @return mixed
*
Expand All @@ -318,7 +317,6 @@ private function generateApiToken($userId)
}

// Init vars
$app = JFactory::getApplication();
$keyModel = new ApiModelKey;
$keysModel = new ApiModelKeys;
$key = null;
Expand Down

0 comments on commit 6eeff8c

Please sign in to comment.