jenkins-bot has submitted this change and it was merged.

Change subject: Remove Special:AutoLogin
......................................................................


Remove Special:AutoLogin

Once all wikis have Ibf6e271f deployed, $wgCentralAuthUseOldAutoLogin
may be set false. Then this may be merged to remove the code related to
Special:AutoLogin entirely.

Bug: 54808
Change-Id: If81765b2cd05f69c649556133eeed91c216185fa
---
M CentralAuth.alias.php
M CentralAuth.i18n.php
M CentralAuth.php
M CentralAuthHooks.php
D specials/SpecialAutoLogin.php
5 files changed, 9 insertions(+), 149 deletions(-)

Approvals:
  CSteipp: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CentralAuth.alias.php b/CentralAuth.alias.php
index d9e0afa..b7a1024 100644
--- a/CentralAuth.alias.php
+++ b/CentralAuth.alias.php
@@ -11,7 +11,6 @@
 /** English (English) */
 $specialPageAliases['en'] = array(
        'CentralAuth' => array( 'CentralAuth' ),
-       'AutoLogin' => array( 'AutoLogin' ),
        'CentralAutoLogin' => array( 'CentralAutoLogin' ),
        'MergeAccount' => array( 'MergeAccount' ),
        'GlobalGroupMembership' => array( 'GlobalUserRights', 
'GlobalGroupMembership' ),
diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index faae6c6..9a05c18 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -299,12 +299,6 @@
        'centralauth-rightslog-set-optin'         => 'opt-in based',
        'centralauth-rightslog-set-optout'        => 'opt-out based',
 
-       // Autologin
-       'autologin'                    => 'Automatic login',
-       'centralauth-autologin-desc'   => 'This special page is used internally 
by MediaWiki.
-When you [[Special:UserLogin|log in]], the central login system instructs your 
browser to request this page from all linked domains, using image links.
-You have requested this page without providing any authentication data, so it 
does nothing.',
-
        // Central login
        'centralautologin'                    => 'Central login',
        'centralauth-centralautologin-desc'   => 'This special page is used 
internally by MediaWiki.
@@ -974,9 +968,6 @@
 * {{msg-mw|Centralauth-rightslog-set-optout}}',
        'centralauth-rightslog-set-optout' => 'See also:
 * {{msg-mw|Centralauth-rightslog-set-optin}}',
-       'autologin' => '{{doc-special|AutoLogin|unlisted=1}}
-See example: [[w:Special:Autologin]].',
-       'centralauth-autologin-desc' => 'This is the text shown on 
[[Special:AutoLogin]] when this page is requested by a user, not by the 
automatic global login system.',
        'centralautologin' => '{{doc-special|CentralAutoLogin|unlisted=1}}
 See example: [[w:Special:CentralAutoLogin]].',
        'centralauth-centralautologin-desc' => 'This is the text shown on 
[[Special:CentralAutoLogin]] when this page is requested by a user, not by the 
automatic global login system.',
diff --git a/CentralAuth.php b/CentralAuth.php
index 8fc5132..c860ba0 100644
--- a/CentralAuth.php
+++ b/CentralAuth.php
@@ -124,12 +124,6 @@
 $wgCentralAuthLoginIcon = false;
 
 /**
- * Set this true until all wikis are running a version with
- * Special:CentralAutoLogin/start available.
- */
-$wgCentralAuthUseOldAutoLogin = true;
-
-/**
  * User preferences for which we should recommend reloading the page after
  * a successful central login query.
  *
@@ -230,7 +224,6 @@
 $wgAutoloadClasses['CentralAuthHooks'] = "$caBase/CentralAuthHooks.php";
 $wgAutoloadClasses['CentralAuthSuppressUserJob'] = 
"$caBase/SuppressUserJob.php";
 $wgAutoloadClasses['WikiSet'] = "$caBase/WikiSet.php";
-$wgAutoloadClasses['SpecialAutoLogin'] = 
"$caBase/specials/SpecialAutoLogin.php";
 $wgAutoloadClasses['SpecialCentralAutoLogin'] = 
"$caBase/specials/SpecialCentralAutoLogin.php";
 $wgAutoloadClasses['CentralAuthUserArray'] = 
"$caBase/CentralAuthUserArray.php";
 $wgAutoloadClasses['CentralAuthUserArrayFromResult'] = 
"$caBase/CentralAuthUserArray.php";
@@ -319,7 +312,6 @@
 
 $wgSpecialPages['CentralAuth'] = 'SpecialCentralAuth';
 $wgSpecialPages['CentralLogin'] = 'SpecialCentralLogin';
-$wgSpecialPages['AutoLogin'] = 'SpecialAutoLogin';
 $wgSpecialPages['CentralAutoLogin'] = 'SpecialCentralAutoLogin';
 $wgSpecialPages['MergeAccount'] = 'SpecialMergeAccount';
 $wgSpecialPages['GlobalGroupMembership'] = 'SpecialGlobalGroupMembership';
diff --git a/CentralAuthHooks.php b/CentralAuthHooks.php
index ad5c92a..fa00734 100644
--- a/CentralAuthHooks.php
+++ b/CentralAuthHooks.php
@@ -321,27 +321,11 @@
                                wfMessage( 'centralauth-login-progress', 
$user->getName() )->escaped() . "</p>\n<p>";
                        foreach ( $wgCentralAuthAutoLoginWikis as $alt => 
$wikiID ) {
                                $wiki = WikiMap::getWiki( $wikiID );
-
-                               global $wgCentralAuthUseOldAutoLogin;
-                               if ( $wgCentralAuthUseOldAutoLogin ) {
-                                       // Use WikiReference::getFullUrl(), 
returns a protocol-relative URL if needed
-                                       $data = array(
-                                               'userName' => $user->getName(),
-                                               'token' => 
$centralUser->getAuthToken(),
-                                               'remember' => $user->getOption( 
'rememberpassword' ),
-                                               'wiki' => $wikiID
-                                       );
-
-                                       $loginToken = MWCryptRand::generateHex( 
32 );
-                                       $wgMemc->set( CentralAuthUser::memcKey( 
'login-token', $loginToken ), $data, 600 );
-                                       $url = wfAppendQuery( 
$wiki->getFullUrl( 'Special:AutoLogin' ), "token=$loginToken" );
-                               } else {
-                                       // Use WikiReference::getFullUrl(), 
returns a protocol-relative URL if needed
-                                       $url = wfAppendQuery( 
$wiki->getFullUrl( 'Special:CentralAutoLogin/start' ), array(
-                                               'type' => 'icon',
-                                               'from' => wfWikiID(),
-                                       ) );
-                               }
+                               // Use WikiReference::getFullUrl(), returns a 
protocol-relative URL if needed
+                               $url = wfAppendQuery( $wiki->getFullUrl( 
'Special:CentralAutoLogin/start' ), array(
+                                       'type' => 'icon',
+                                       'from' => wfWikiID(),
+                               ) );
                                $inject_html .= Xml::element( 'img',
                                        array(
                                                'src' => $url,
@@ -630,27 +614,10 @@
                                wfMessage( 'centralauth-logout-progress', 
$user->getName() )->escaped() . "</p>\n<p>";
                        foreach ( $wikis as $alt => $wikiID ) {
                                $wiki = WikiMap::getWiki( $wikiID );
-
-                               global $wgCentralAuthUseOldAutoLogin;
-                               if ( $wgCentralAuthUseOldAutoLogin ) {
-                                       // Use WikiReference::getFullUrl(), 
returns a protocol-relative URL if needed
-                                       $centralUser = 
CentralAuthUser::getInstance( $user );
-                                       $data = array(
-                                               'userName' => $user->getName(),
-                                               'token' => 
$centralUser->getAuthToken(),
-                                               'remember' => $user->getOption( 
'rememberpassword' ),
-                                               'wiki' => $wikiID,
-                                               'action' => 'logout',
-                                       );
-                                       $loginToken = MWCryptRand::generateHex( 
32 );
-                                       $wgMemc->set( CentralAuthUser::memcKey( 
'login-token', $loginToken ), $data, 600 );
-                                       $url = wfAppendQuery( 
$wiki->getFullUrl( 'Special:AutoLogin' ), "logout=1&token=$loginToken" );
-                               } else {
-                                       // Use WikiReference::getFullUrl(), 
returns a protocol-relative URL if needed
-                                       $url = wfAppendQuery( 
$wiki->getFullUrl( 'Special:CentralAutoLogin/deleteCookies' ), array(
-                                               'type' => 'icon',
-                                       ) );
-                               }
+                               // Use WikiReference::getFullUrl(), returns a 
protocol-relative URL if needed
+                               $url = wfAppendQuery( $wiki->getFullUrl( 
'Special:CentralAutoLogin/deleteCookies' ), array(
+                                       'type' => 'icon',
+                               ) );
                                $inject_html .= Xml::element( 'img',
                                        array(
                                                'src' => $url,
diff --git a/specials/SpecialAutoLogin.php b/specials/SpecialAutoLogin.php
deleted file mode 100644
index 522dbf6..0000000
--- a/specials/SpecialAutoLogin.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * Unlisted Special page to set requisite cookies for being logged into this 
wiki.
- *
- * @ingroup Extensions
- */
-class SpecialAutoLogin extends UnlistedSpecialPage {
-       function __construct() {
-               parent::__construct( 'AutoLogin' );
-       }
-
-       function execute( $par ) {
-               global $wgMemc;
-
-               $tempToken = $this->getRequest()->getVal( 'token' );
-               $logout = $this->getRequest()->getBool( 'logout' );
-
-               # Don't cache error messages
-               $this->getOutput()->enableClientCache( false );
-
-               if ( strlen( $tempToken ) == 0 ) {
-                       $this->setHeaders();
-                       $this->getOutput()->addWikiMsg( 
'centralauth-autologin-desc' );
-                       return;
-               }
-
-               $key = CentralAuthUser::memcKey( 'login-token', $tempToken );
-               $data = $wgMemc->get( $key );
-               $wgMemc->delete( $key );
-
-               if ( !$data ) {
-                       $msg = 'Token is invalid or has expired';
-                       wfDebug( __METHOD__ . ": $msg\n" );
-                       $this->setHeaders();
-                       $this->getOutput()->addWikiText( $msg );
-                       return;
-               }
-
-               $userName = $data['userName'];
-               $token = $data['token'];
-               $remember = $data['remember'];
-
-               if ( $data['wiki'] != wfWikiID() ) {
-                       $msg = 'Bad token (wrong wiki)';
-                       wfDebug( __METHOD__ . ": $msg\n" );
-                       $this->setHeaders();
-                       $this->getOutput()->addWikiText( $msg );
-                       return;
-               }
-
-               $centralUser = new CentralAuthUser( $userName );
-               $loginResult = $centralUser->authenticateWithToken( $token );
-
-               if ( $loginResult !== 'ok' && !$logout ) {
-                       $msg = "Bad token: $loginResult";
-                       wfDebug( __METHOD__ . ": $msg\n" );
-                       $this->setHeaders();
-                       $this->getOutput()->addWikiText( $msg );
-                       return;
-               } elseif ( $logout && $loginResult === 'ok' ) {
-                       $msg = "Logout token, but user didn't log out";
-                       wfDebug( __METHOD__ . ": $msg\n" );
-                       $this->setHeaders();
-                       $this->getOutput()->addWikiText( $msg );
-                       return;
-               }
-
-               // Auth OK.
-               if ( $logout ) {
-                       CentralAuthUser::deleteGlobalCookies();
-               } else {
-                       $centralUser->setGlobalCookies( $remember );
-               }
-
-               $this->getOutput()->disable();
-
-               wfResetOutputBuffers();
-               header( 'Cache-Control: no-cache' );
-               header( 'Content-Type: image/png' );
-
-               global $wgCentralAuthLoginIcon;
-               if ( $wgCentralAuthLoginIcon ) {
-                       readfile( $wgCentralAuthLoginIcon );
-               } else {
-                       readfile( __DIR__ . '/1x1.png' );
-               }
-       }
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/64253
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If81765b2cd05f69c649556133eeed91c216185fa
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to