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

Change subject: Remove $wgCentralAuthSilentLogin, defaulted to true
......................................................................


Remove $wgCentralAuthSilentLogin, defaulted to true

Clean up feature flag that was requested for Ibf6e271f.

Bug: 54808
Change-Id: Ib9e700f8c8ecab25e529bd4135d3b9af2f1a744e
---
M CentralAuth.i18n.php
M CentralAuth.php
M CentralAuthHooks.php
M modules/ext.centralauth.js
M specials/SpecialCentralLogin.php
5 files changed, 33 insertions(+), 105 deletions(-)

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



diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index fbb1237..faae6c6 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -424,10 +424,6 @@
 
        'centrallogin' => 'Central user log in',
        'centralloginsuccesful' => 'Login successful',
-       'centralauth-completelogin-legend' => 'Complete login process',
-       'centralauth-completelogin-finishing' => 'Authenticating on Wikimedia 
Foundation sites, please wait...',
-       'centralauth-completelogin-text' => 'Authentication of your account on 
Wikimedia Foundation sites is almost complete! Use the button below to confirm 
and complete your login.',
-       'centralauth-completelogin-submit' => 'Log in now',
        'centralauth-completelogin-back' => 'Return to the previous page.',
 
        'centralauth-error-nologinattempt' => 'No active login attempt is in 
progress for your session.',
@@ -1114,11 +1110,6 @@
        'centrallogin' => '{{doc-special|CentralLogin|unlisted=1}}',
        'centralloginsuccesful' => 'Used as page title.
 {{Identical|Login successful}}',
-       'centralauth-completelogin-legend' => 'Used as the fieldset label.
-
-Followed by the Submit button text 
{{msg-mw|Centralauth-completelogin-submit}}.',
-       'centralauth-completelogin-finishing' => 'Shown next to a spinner while 
the user is being logged in',
-       'centralauth-completelogin-submit' => 'Used as label for the Submit 
button.',
        'centralauth-completelogin-back' => 'Used as action link text.',
        'centralauth-error-token-wronguser' => 'Used as error message.',
        'centralauth-warning-notloggedin' => 'Used as error message.',
diff --git a/CentralAuth.php b/CentralAuth.php
index f999b5d..8fc5132 100644
--- a/CentralAuth.php
+++ b/CentralAuth.php
@@ -118,12 +118,6 @@
 $wgCentralAuthAutoLoginWikis = array();
 
 /**
- * Whether login should be done silently (with 302 redirects)
- * Note this may eventually be defaulted to true and removed.
- */
-$wgCentralAuthSilentLogin = false;
-
-/**
  * Local filesystem path to the icon returned by Special:CentralAutoLogin
  * Should be a 20x20px PNG.
  */
@@ -408,7 +402,6 @@
                'centralauth-merge-method-login-desc',
                'centralauth-admin-delete-confirm',
                'centralauth-completelogin-back',
-               'centralauth-completelogin-finishing'
        ),
 ) + $commonModuleInfo;
 $wgResourceModules['ext.centralauth.centralautologin'] = array(
diff --git a/CentralAuthHooks.php b/CentralAuthHooks.php
index 4da021c..ad5c92a 100644
--- a/CentralAuthHooks.php
+++ b/CentralAuthHooks.php
@@ -287,7 +287,6 @@
         */
        static function onUserLoginComplete( &$user, &$inject_html ) {
                global $wgCentralAuthLoginWiki, $wgCentralAuthCookies;
-               global $wgCentralAuthSilentLogin;
 
                if ( !$wgCentralAuthCookies ) {
                        // Use local sessions only.
@@ -300,21 +299,8 @@
                        return true;
                }
 
-               if ( $wgCentralAuthSilentLogin ) {
-                       // Redirect to the central wiki and back to complete 
login, if necessary
-                       self::doCentralLoginRedirect( $user, $centralUser, 
$inject_html );
-               } else {
-                       if ( $wgCentralAuthLoginWiki ) {
-                               // Set $inject_html to some text to bypass the 
LoginForm redirection
-                               $inject_html .= wfMessage( 
'centralauth-login-no-others' )->escaped();
-                               // Redirect to the central wiki and back to 
complete login
-                               $dummy = '';
-                               self::doCentralLoginRedirect( $user, 
$centralUser, $dummy );
-                       } else {
-                               // Show HTML to create cross-domain cookies
-                               $inject_html .= self::getDomainAutoLoginHtml( 
$user, $centralUser );
-                       }
-               }
+               // Redirect to the central wiki and back to complete login, if 
necessary
+               self::doCentralLoginRedirect( $user, $centralUser, $inject_html 
);
 
                return true;
        }
@@ -1121,19 +1107,16 @@
 
                        if ( $out->getRequest()->getSessionData( 
'CentralAuthDoEdgeLogin' ) ) {
                                $out->getRequest()->setSessionData( 
'CentralAuthDoEdgeLogin', null );
-                               global $wgCentralAuthSilentLogin;
-                               if ( $wgCentralAuthSilentLogin ) {
-                                       $out->addHTML( self::getEdgeLoginHTML() 
);
+                               $out->addHTML( self::getEdgeLoginHTML() );
 
-                                       if ( $wgCentralAuthUseEventLogging ) {
-                                               // Need to correlate user_id 
across wikis
-                                               efLogServerSideEvent( 
'CentralAuth', 5690875,
-                                                       array( 'version' => 1,
-                                                               'userId' => 
$centralUser->getId(),
-                                                               'action' => 
'sul2-autologin-login'
-                                                       )
-                                               );
-                                       }
+                               if ( $wgCentralAuthUseEventLogging ) {
+                                       // Need to correlate user_id across 
wikis
+                                       efLogServerSideEvent( 'CentralAuth', 
5690875,
+                                               array( 'version' => 1,
+                                                       'userId' => 
$centralUser->getId(),
+                                                       'action' => 
'sul2-autologin-login'
+                                               )
+                                       );
                                }
                        }
                }
diff --git a/modules/ext.centralauth.js b/modules/ext.centralauth.js
index cca8f1f..0dd38f3 100644
--- a/modules/ext.centralauth.js
+++ b/modules/ext.centralauth.js
@@ -43,11 +43,6 @@
        $( document ).ready( function () {
                /*global confirm */
 
-               // Automatic form submission on CentralLogin/start
-               $( '#mw-centralloginform' )
-                       .before( $( '<p>' + mw.msg( 
'centralauth-completelogin-finishing' ) + '</p>' ) )
-                       .before( $.createSpinner({ size: 'small', type: 
'inline' }) );
-               setTimeout( function () { $( '#mw-centralloginform' ).submit(); 
}, 600 );
                // Back link for CentralLogin/start
                $( '#centralauth-backlink-section' ).append(
                        $( '<a>' )
diff --git a/specials/SpecialCentralLogin.php b/specials/SpecialCentralLogin.php
index 27c3373..5177908 100644
--- a/specials/SpecialCentralLogin.php
+++ b/specials/SpecialCentralLogin.php
@@ -45,7 +45,7 @@
         * @throws MWException
         */
        protected function doLoginStart( $token ) {
-               global $wgMemc, $wgCentralAuthSilentLogin;
+               global $wgMemc;
 
                $key = CentralAuthUser::memcKey( 'central-login-start-token', 
$token );
 
@@ -123,28 +123,9 @@
                //currentProto = the login form's protocol, so we go back to 
here. May then redir to finalProto
                $url = $info['currentProto'] . ':' . $url;
 
-               if ( $wgCentralAuthSilentLogin ) {
-                       $url = wfAppendQuery( $url, array( 'token' => $token ) 
); // expands to PROTO_CURRENT if $url doesn't have protocol
-                       wfRunHooks( 'CentralAuthSilentLoginRedirect', array( 
$centralUser, &$url, $info ) );
-                       $this->getOutput()->redirect( $url );
-               } else {
-                       $this->getOutput()->addHtml(
-                               Xml::openElement( 'form',
-                               array( 'method' => 'post', 'action' => $url, 
'id' => 'mw-centralloginform' ) ) .
-                               Html::rawElement( 'p', null,
-                                       $this->msg( 
'centralauth-completelogin-text' )->parse() ) .
-                                       Html::hidden( 'token', $token ) .
-                                       Xml::openElement( 'fieldset' ) .
-                                       Html::rawElement( 'legend',
-                                               null, $this->msg( 
'centralauth-completelogin-legend' )->parse() ) .
-                                               Xml::submitButton( $this->msg( 
'centralauth-completelogin-submit' )->text() ) .
-                                               Xml::closeElement( 'fieldset' ) 
.
-                                               Xml::closeElement( 'form' ) . 
"\n"
-                                       );
-                       $this->getOutput()->addInlineStyle( // hide the form 
and let JS submit it
-                               '.client-js #mw-centralloginform { display: 
none; }'
-                       );
-               }
+               $url = wfAppendQuery( $url, array( 'token' => $token ) ); // 
expands to PROTO_CURRENT if $url doesn't have protocol
+               wfRunHooks( 'CentralAuthSilentLoginRedirect', array( 
$centralUser, &$url, $info ) );
+               $this->getOutput()->redirect( $url );
        }
 
        /**
@@ -153,7 +134,6 @@
         */
        protected function doLoginComplete( $token ) {
                global $wgUser, $wgMemc, $wgSecureLogin;
-               global $wgCentralAuthSilentLogin;
 
                $request = $this->getRequest();
 
@@ -215,41 +195,27 @@
                // which is needed or the personal links will be wrong.
                $this->getContext()->setUser( $user );
 
-               if ( $wgCentralAuthSilentLogin ) {
-                       // Mark the session to include the edge login imgs on 
the next pageview
-                       $request->setSessionData( 'CentralAuthDoEdgeLogin', 
true );
+               // Mark the session to include the edge login imgs on the next 
pageview
+               $request->setSessionData( 'CentralAuthDoEdgeLogin', true );
 
-                       // Show the login success page
-                       $form = new LoginForm( new FauxRequest() );
+               // Show the login success page
+               $form = new LoginForm( new FauxRequest() );
 
-                       // Allow other extensions to modify the returnTo and 
returnToQuery
-                       wfRunHooks( 'CentralAuthPostLoginRedirect', array(
-                               &$attempt['returnTo'],
-                               &$attempt['returnToQuery'],
-                               $attempt['stickHTTPS'],
-                               $attempt['type']
-                       ) );
+               // Allow other extensions to modify the returnTo and 
returnToQuery
+               wfRunHooks( 'CentralAuthPostLoginRedirect', array(
+                       &$attempt['returnTo'],
+                       &$attempt['returnToQuery'],
+                       $attempt['stickHTTPS'],
+                       $attempt['type']
+               ) );
 
-                       $form->showReturnToPage(
-                               'successredirect',
-                               $attempt['returnTo'],
-                               $attempt['returnToQuery'],
-                               ( $attempt['finalProto'] == 'https' ) // 
influnces http/https of returnTo page
-                       );
-                       $this->getOutput()->setPageTitle( $this->msg( 
'centralloginsuccesful' ) );
-               } else {
-                       // Show the login success page
-                       $form = new LoginForm( new FauxRequest() );
-                       $form->showReturnToPage( 'success',
-                               $attempt['returnTo'], 
$attempt['returnToQuery'], $attempt['stickHTTPS'] );
-                       $this->getOutput()->setPageTitle( $this->msg( 
'centralloginsuccesful' ) );
-
-                       // Show HTML to trigger cross-domain cookies.
-                       // This will trigger filling in the "remember me" token 
cookie on the
-                       // central wiki, which can only be done once 
authorization is completed.
-                       $this->getOutput()->addHtml(
-                               CentralAuthHooks::getDomainAutoLoginHtml( 
$user, $centralUser ) );
-               }
+               $form->showReturnToPage(
+                       'successredirect',
+                       $attempt['returnTo'],
+                       $attempt['returnToQuery'],
+                       ( $attempt['finalProto'] == 'https' ) // influnces 
http/https of returnTo page
+               );
+               $this->getOutput()->setPageTitle( $this->msg( 
'centralloginsuccesful' ) );
        }
 
        protected function showLoginStatus() {

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

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

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

Reply via email to