Merge "Follow-up I087c2729 (750936f): factorise common code"
authorNikerabbit <niklas.laxstrom@gmail.com>
Wed, 21 Nov 2012 15:04:13 +0000 (15:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 21 Nov 2012 15:04:13 +0000 (15:04 +0000)
1  2 
includes/specials/SpecialUserlogin.php

@@@ -559,7 -559,7 +559,7 @@@ class LoginForm extends SpecialPage 
                }
  
                $isAutoCreated = false;
 -              if ( 0 == $u->getID() ) {
 +              if ( $u->getID() == 0 ) {
                        $status = $this->attemptAutoCreate( $u );
                        if ( $status !== self::SUCCESS ) {
                                return $status;
                } else {
                        global $wgExternalAuthType, $wgAutocreatePolicy;
                        if ( $wgExternalAuthType && $wgAutocreatePolicy != 'never'
 -                      && is_object( $this->mExtUser )
 -                      && $this->mExtUser->authenticate( $this->mPassword ) ) {
 +                              && is_object( $this->mExtUser )
 +                              && $this->mExtUser->authenticate( $this->mPassword )
 +                      ) {
                                # The external user and local user have the same name and
                                # password, so we assume they're the same.
                                $this->mExtUser->linkToLocal( $u->getID() );
                wfRunHooks( 'UserLoginComplete', array( &$currentUser, &$injected_html ) );
  
                if( $injected_html !== '' ) {
-                       $this->displaySuccessfulLogin( 'loginsuccess', $injected_html );
+                       $this->displaySuccessfulAction( $this->msg( 'loginsuccesstitle' ),
+                               'loginsuccess', $injected_html );
                } else {
                        $this->executeReturnTo( 'successredirect' );
                }
                 */
                wfRunHooks( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) );
  
-               $this->displaySuccessfulAccountCreation( $welcome_creation_msg, $injected_html );
+               $this->displaySuccessfulAction( $this->msg( 'welcomeuser', $this->getUser()->getName() ),
+                       $welcome_creation_msg, $injected_html );
        }
  
        /**
-        * Display an "account creation successful" page.
-        * @param $msgname string
-        * @param $injected_html string
-        */
-       private function displaySuccessfulAccountCreation( $msgname, $injected_html ) {
-               $out = $this->getOutput();
-               $out->setPageTitle( $this->msg( 'welcomeuser', $this->getUser()) );
-               if( $msgname ){
-                       $out->addWikiMsg( $msgname, wfEscapeWikiText( $this->getUser()->getName() ) );
-               }
-               $out->addHTML( $injected_html );
-               $this->executeReturnTo( 'success' );
-       }
-       /**
-        * Display a "login successful" page.
+        * Display an "successful action" page.
+        *
+        * @param $title string|Message page's title
         * @param $msgname string
         * @param $injected_html string
         */
-       private function displaySuccessfulLogin( $msgname, $injected_html ) {
+       private function displaySuccessfulAction( $title, $msgname, $injected_html ) {
                $out = $this->getOutput();
-               $out->setPageTitle( $this->msg( 'loginsuccesstitle' ) );
-               if( $msgname ){
+               $out->setPageTitle( $title );
+               if ( $msgname ) {
                        $out->addWikiMsg( $msgname, wfEscapeWikiText( $this->getUser()->getName() ) );
                }