Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
class OAuth2ClientHooks {
public static function onPersonalUrls( array &$personal_urls, Title $title ) {

global $wgOAuth2Client, $wgUser, $wgRequest;
if( $wgUser->isLoggedIn() ) return true;
global $wgOAuth2Client, $wgRequest;

$user = RequestContext::getMain()->getUser();
if( $user->isRegistered() ) return true;


# Due to bug 32276, if a user does not have read permissions,
Expand Down
9 changes: 5 additions & 4 deletions SpecialOAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ private function _handleCallback(){
}

private function _default(){
global $wgOAuth2Client, $wgOut, $wgUser, $wgScriptPath, $wgExtensionAssetsPath;
global $wgOAuth2Client, $wgOut, $wgScriptPath, $wgExtensionAssetsPath;

$service_name = ( isset( $wgOAuth2Client['configuration']['service_name'] ) && 0 < strlen( $wgOAuth2Client['configuration']['service_name'] ) ? $wgOAuth2Client['configuration']['service_name'] : 'OAuth2' );

$wgOut->setPagetitle( wfMessage( 'oauth2client-login-header', $service_name)->text() );
if ( !$wgUser->isLoggedIn() ) {
$user = RequestContext::getMain()->getUser();
if ( !$user->isRegistered() ) {
$wgOut->addWikiMsg( 'oauth2client-you-can-login-to-this-wiki-with-oauth2', $service_name );
$wgOut->addWikiMsg( 'oauth2client-login-with-oauth2', $this->getTitle( 'redirect' )->getPrefixedURL(), $service_name );

Expand Down Expand Up @@ -197,8 +199,7 @@ protected function _userHandling( $response ) {
$user->setCookies();
$this->getContext()->setUser( $user );
$user->saveSettings();
global $wgUser;
$wgUser = $user;
RequestContext::getMain()->setUser( $user );
$sessionUser = User::newFromSession($this->getRequest());
$sessionUser->load();
return $user;
Expand Down