Merge "MessagesGom_deva: Correct syntax in namespace alias"
[lhc/web/wiklou.git] / includes / specials / pre-authmanager / SpecialUserlogin.php
index e8c13e3..09132f2 100644 (file)
@@ -699,7 +699,7 @@ class LoginFormPreAuthManager extends SpecialPage {
 
                $u->setEmail( $this->mEmail );
                $u->setRealName( $this->mRealName );
-               SessionManager::singleton()->invalidateSessionsForUser( $u );
+               $u->setToken();
 
                Hooks::run( 'LocalUserCreated', [ $u, $autocreate ] );
                $oldUser = $u;
@@ -894,7 +894,8 @@ class LoginFormPreAuthManager extends SpecialPage {
         */
        public static function incrementLoginThrottle( $username ) {
                global $wgPasswordAttemptThrottle, $wgRequest;
-               $username = User::getCanonicalName( $username, 'usable' ) ?: $username;
+               $canUsername = User::getCanonicalName( $username, 'usable' );
+               $username = $canUsername !== false ? $canUsername : $username;
 
                $throttleCount = 0;
                if ( is_array( $wgPasswordAttemptThrottle ) ) {
@@ -979,7 +980,8 @@ class LoginFormPreAuthManager extends SpecialPage {
         */
        public static function clearLoginThrottle( $username ) {
                global $wgRequest, $wgPasswordAttemptThrottle;
-               $username = User::getCanonicalName( $username, 'usable' ) ?: $username;
+               $canUsername = User::getCanonicalName( $username, 'usable' );
+               $username = $canUsername !== false ? $canUsername : $username;
 
                if ( is_array( $wgPasswordAttemptThrottle ) ) {
                        $throttleConfig = $wgPasswordAttemptThrottle;
@@ -1197,7 +1199,7 @@ class LoginFormPreAuthManager extends SpecialPage {
        protected function resetLoginForm( Message $msg ) {
                // Allow hooks to explain this password reset in more detail
                Hooks::run( 'LoginPasswordResetMessage', [ &$msg, $this->mUsername ] );
-               $reset = new SpecialChangePassword();
+               $reset = new SpecialChangePasswordPreAuthManager();
                $derivative = new DerivativeContext( $this->getContext() );
                $derivative->setTitle( $reset->getPageTitle() );
                $reset->setContext( $derivative );
@@ -1260,7 +1262,8 @@ class LoginFormPreAuthManager extends SpecialPage {
                # Run any hooks; display injected HTML if any, else redirect
                $currentUser = $this->getUser();
                $injected_html = '';
-               Hooks::run( 'UserLoginComplete', [ &$currentUser, &$injected_html ] );
+               $direct = RequestContext::getMain()->getRequest()->wasPosted();
+               Hooks::run( 'UserLoginComplete', [ &$currentUser, &$injected_html, $direct ] );
 
                if ( $injected_html !== '' ) {
                        $this->displaySuccessfulAction( 'success', $this->msg( 'loginsuccesstitle' ),
@@ -1281,8 +1284,9 @@ class LoginFormPreAuthManager extends SpecialPage {
                $currentUser = $this->getUser();
                $injected_html = '';
                $welcome_creation_msg = 'welcomecreation-msg';
+               $direct = RequestContext::getMain()->getRequest()->wasPosted();
 
-               Hooks::run( 'UserLoginComplete', [ &$currentUser, &$injected_html ] );
+               Hooks::run( 'UserLoginComplete', [ &$currentUser, &$injected_html, $direct ] );
 
                /**
                 * Let any extensions change what message is shown.
@@ -1716,6 +1720,7 @@ class LoginFormPreAuthManager extends SpecialPage {
                }
 
                SessionManager::getGlobalSession()->resetId();
+               SessionManager::getGlobalSession()->resetAllTokens();
        }
 
        /**