jenkins-bot has submitted this change and it was merged. Change subject: Fix CentralAuth logins ......................................................................
Fix CentralAuth logins Depends on https://gerrit.wikimedia.org/r/75154 but doesn't require it for deployment. Bug: 51789 Change-Id: I578b69555ec1fd9e2014ca06c6e0533057a2c7f8 --- M MobileFrontend.php M includes/MobileFrontend.hooks.php 2 files changed, 40 insertions(+), 0 deletions(-) Approvals: Aaron Schulz: Looks good to me, but someone else must approve Jdlrobson: Looks good to me, approved jenkins-bot: Verified diff --git a/MobileFrontend.php b/MobileFrontend.php index 919d6f3..6a68aec 100644 --- a/MobileFrontend.php +++ b/MobileFrontend.php @@ -113,6 +113,8 @@ $wgHooks['GetPreferences'][] = 'MobileFrontendHooks::onGetPreferences'; $wgHooks['Gadgets::allowLegacy'][] = 'MobileFrontendHooks::onAllowLegacyGadgets'; $wgHooks['UnitTestsList'][] = 'MobileFrontendHooks::onUnitTestsList'; +$wgHooks['CentralAuthLoginRedirectData'][] = 'MobileFrontendHooks::onCentralAuthLoginRedirectData'; +$wgHooks['CentralAuthSilentLoginRedirect'][] = 'MobileFrontendHooks::onCentralAuthSilentLoginRedirect'; $wgSpecialPages['MobileDiff'] = 'SpecialMobileDiff'; $wgSpecialPages['MobileOptions'] = 'SpecialMobileOptions'; diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 4059c96..2b48519 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -504,4 +504,42 @@ $files[] = "$dir/specials/SpecialMobileDiffTest.php"; return true; } + + /** + * CentralAuthLoginRedirectData hook handler + * Saves mobile host so that the CentralAuth wiki could redirect back properly + * + * @param $centralUser + * @param $data + * + * @return bool + */ + public static function onCentralAuthLoginRedirectData( $centralUser, &$data ) { + global $wgServer; + $context = MobileContext::singleton(); + if ( $context->shouldDisplayMobileView() ) { + $data['mobileServer'] = $context->getMobileUrl( $wgServer ); + } + return true; + } + + /** + * CentralAuthSilentLoginRedirect hook handler + * Points redirects from CentralAuth wiki to mobile domain if user has logged in from it + * + * @param $centralUser + * @param $url + * @param $info + * + * @return bool + */ + public static function onCentralAuthSilentLoginRedirect( $centralUser, &$url, $info ) { + if ( isset( $info['mobileServer'] ) ) { + $mobileUrlParsed = wfParseUrl( $info['mobileServer'] ); + $urlParsed = wfParseUrl( $url ); + $urlParsed['host'] = $mobileUrlParsed['host']; + $url = wfAssembleUrl( $urlParsed ); + } + return true; + } } -- To view, visit https://gerrit.wikimedia.org/r/75155 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I578b69555ec1fd9e2014ca06c6e0533057a2c7f8 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: MaxSem <[email protected]> Gerrit-Reviewer: Aaron Schulz <[email protected]> Gerrit-Reviewer: Jdlrobson <[email protected]> Gerrit-Reviewer: MaxSem <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
