From 661d4e95759fdca231943ecdc16aa1898a41618a Mon Sep 17 00:00:00 2001 From: Jens Timmerman Date: Mon, 7 Jul 2014 17:19:00 +0200 Subject: [PATCH 1/2] $title->mArticleID is always -1 it seems `$title->mArticleID` is always -1, I don't know why, but this check makes a redirect to the page where the login was started fail. --- SpecialOAuth2Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpecialOAuth2Client.php b/SpecialOAuth2Client.php index 262735c..2598eb2 100644 --- a/SpecialOAuth2Client.php +++ b/SpecialOAuth2Client.php @@ -127,7 +127,7 @@ private function _handleCallback(){ unset( $_SESSION['returnto'] ); } - if( !$title instanceof Title || 0 > $title->mArticleID ) { + if( !$title instanceof Title ) { $title = Title::newMainPage(); } $wgOut->redirect( $title->getFullURL() ); From eedfe76cd1d39c513e9dde2b98bdb96b4a52830c Mon Sep 17 00:00:00 2001 From: Jens Timmerman Date: Wed, 9 Jul 2014 15:33:15 +0200 Subject: [PATCH 2/2] remove password and rememberpassword options These should not be visible int he preferences, they do not make sense for oauth users. --- OAuth2Client.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OAuth2Client.php b/OAuth2Client.php index f3ac812..5f5fe42 100644 --- a/OAuth2Client.php +++ b/OAuth2Client.php @@ -51,6 +51,7 @@ $wgHooks['PersonalUrls'][] = 'OAuth2ClientHooks::onPersonalUrls'; $wgHooks['UserLogout'][] = 'OAuth2ClientHooks::onUserLogout'; +$wgHooks['GetPreferences'][] = 'OAuth2ClientHooks::RedirectPrefs'; class OAuth2ClientHooks { public static function onPersonalUrls( array &$personal_urls, Title $title ) { @@ -118,6 +119,13 @@ public static function onUserLogout( &$user ) { return true; } + // Remove reset password link and remember password checkbox from preferences page + public static function RedirectPrefs($user, &$preferences) { + unset($preferences["password"]); + unset($preferences["rememberpassword"]); + return true; + } + public static function getOAuth2VendorClassPath() { return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendors' . DIRECTORY_SEPARATOR . 'oauth_2'; }