From 446f94f2ef285ccb6ce59d48f50154035cd80e2b Mon Sep 17 00:00:00 2001 From: Tom Homer Date: Wed, 28 Dec 2016 14:32:09 -0500 Subject: [PATCH] OAuth Errors now are set to write to error log file --- public_html/users.php | 7 ++++--- system/classes/oauthhelper.class.php | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public_html/users.php b/public_html/users.php index ee3008722..dca62d79c 100644 --- a/public_html/users.php +++ b/public_html/users.php @@ -895,7 +895,7 @@ function resend_request() $active_service = (count($modules) == 0) ? false : in_array($_GET['oauth_login'], $modules); if (!$active_service) { $status = -1; - COM_errorLog("OAuth login failed - there was no consumer available for the service:" . $_GET['oauth_login']); + COM_errorLog("OAuth login failed - there was no consumer available for the service:" . $_GET['oauth_login'], 1); } else { $query = array_merge($_GET, $_POST); $service = $query['oauth_login']; @@ -913,14 +913,15 @@ function resend_request() $consumer->setRedirectURL($callback_url); $oauth_userinfo = $consumer->authenticate_user(); + if ( $oauth_userinfo === false ) { COM_updateSpeedlimit('login'); - COM_errorLog("OAuth Error: " . $consumer->error); + COM_errorLog("OAuth Error: " . $consumer->error, 1); COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error } if ( $consumer->doAction($oauth_userinfo) == NULL ) { - COM_errorLog("Oauth: Error creating new user in OAuth authentication"); + COM_errorLog("Oauth: Error creating new user in OAuth authentication", 1); COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error } } diff --git a/system/classes/oauthhelper.class.php b/system/classes/oauthhelper.class.php index f6f5f8f5a..065bf2530 100644 --- a/system/classes/oauthhelper.class.php +++ b/system/classes/oauthhelper.class.php @@ -164,7 +164,7 @@ public function authenticate_user() $success = $this->client->Finalize($success); } if ($_SYSTEM['debug_oauth']) { - COM_errorLog($this->client->debug_output); + COM_errorLog($this->client->debug_output, 1); } if ($this->client->exit) { exit; @@ -213,10 +213,10 @@ public function doAction($info) // remote auth precludes usersubmission, and integrates user activation $status = USER_ACCOUNT_ACTIVE; - + $users = $this->_getCreateUserInfo($info); $userInfo = $this->_getUpdateUserInfo($info); - + $sql = "SELECT uid, status FROM {$_TABLES['users']} " . "WHERE remoteusername = '" . DB_escapeString($users['remoteusername']) . "' " . "AND remoteservice = '" . DB_escapeString($users['remoteservice']) . "'";