Skip to content

Commit

Permalink
OAuth Twitter Email now Collected Feature #703
Browse files Browse the repository at this point in the history
Also added license file and oauth config file for other oauth clients
  • Loading branch information
eSilverStrike committed Dec 23, 2016
1 parent 9f329a8 commit e787ec3
Show file tree
Hide file tree
Showing 5 changed files with 576 additions and 60 deletions.
13 changes: 8 additions & 5 deletions public_html/users.php
Expand Up @@ -913,14 +913,17 @@ function resend_request()

$consumer->setRedirectURL($callback_url);
$oauth_userinfo = $consumer->authenticate_user();
if ($oauth_userinfo === false) {
if ( $oauth_userinfo === false ) {
COM_updateSpeedlimit('login');
COM_errorLog("OAuth Error: " . $consumer->error);
COM_redirect($_CONF['site_url'] . '/users.php?msg=110'); // OAuth authentication error
COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error
}

$consumer->doAction($oauth_userinfo);
}

if ( $consumer->doAction($oauth_userinfo) == NULL ) {
COM_errorLog("Oauth: Error creating new user in OAuth authentication");
COM_redirect($_CONF['site_url'] . '/users.php?msg=111'); // OAuth authentication error
}
}
} else {
$status = -2; // User just visited login page no error. -1 = error
}
Expand Down
10 changes: 4 additions & 6 deletions public_html/usersettings.php
Expand Up @@ -1445,7 +1445,7 @@ function savepreferences($A)

case 'synch':
// This case is the result of a callback from an OAuth service.
// The user has made a request to resynch their glFusion user account with the remote OAuth service
// The user has made a request to resynch their Geeklog user account with the remote OAuth service
if ($_CONF['user_login_method']['oauth'] && (strpos($_USER['remoteservice'], 'oauth.') === 0)
&& isset($_GET['oauth_login'])
) {
Expand All @@ -1469,7 +1469,7 @@ function savepreferences($A)

$consumer = new OAuthConsumer($service);

if ($service === 'oauth.facebook') {
if($service == 'oauth.facebook') {
// facebook resynchronizations are simple to perform
$oauth_userinfo = $consumer->refresh_userinfo();
if (empty($oauth_userinfo)) {
Expand All @@ -1489,11 +1489,9 @@ function savepreferences($A)
// COM_errorLog("callback_url={$callback_url}");

// authenticate with the remote service
if (!isset($query[$callback_query_string]) &&
(empty($cancel_query_string) || !isset($query[$cancel_query_string]))
) {
if (!isset($query[$callback_query_string]) && (empty($cancel_query_string) || !isset($query[$cancel_query_string]))) {
$msg = 114; // Resynch with remote account has failed but other account information has been successfully saved
// elseif the callback query string is set, then we have successfully authenticated
// elseif the callback query string is set, then we have successfully authenticated
} elseif (isset($query[$callback_query_string])) {
// COM_errorLog("authenticated with remote service, retrieve userinfo");
// foreach($query as $key=>$value) {
Expand Down
37 changes: 37 additions & 0 deletions system/classes/oauth/LICENSE
@@ -0,0 +1,37 @@
PHP OAuth API - Access API authorized by the users
using the OAuth protocol

This LICENSE is in the BSD license style.

License Version Control:
@(#) $Id: LICENSE,v 1.2 2013/02/11 05:17:53 mlemos Exp $

Copyright (c) 2012-2013, Manuel Lemos
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

Neither the name of Manuel Lemos nor the names of his contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 comments on commit e787ec3

Please sign in to comment.