X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecialpage%2FLoginSignupSpecialPage.php;h=1e037748b305499e58f1b0cdbb37069fd72cb09d;hp=bf83e7bb37f5ab4874db26a31497d6ca48cdcc6c;hb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;hpb=e3f6c10d87732c0c8a9bbd7bb57b6c964b92e29a diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index bf83e7bb37..1e037748b3 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -156,7 +156,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { [ 'returnto' => $this->mReturnTo, 'returntoquery' => $this->mReturnToQuery, - 'uselang' => $this->mLanguage, + 'uselang' => $this->mLanguage ?: null, 'fromhttp' => $wgSecureLogin && $this->mFromHTTP ? '1' : null, ] ); @@ -508,7 +508,11 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { } // warning header for non-standard workflows (e.g. security reauthentication) - if ( !$this->isSignup() && $this->getUser()->isLoggedIn() ) { + if ( + !$this->isSignup() && + $this->getUser()->isLoggedIn() && + $this->authAction !== AuthManager::ACTION_LOGIN_CONTINUE + ) { $reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin'; $submitStatus->warning( $reauthMessage, $this->getUser()->getName() ); } @@ -615,7 +619,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $form = HTMLForm::factory( 'vform', $formDescriptor, $context ); $form->addHiddenField( 'authAction', $this->authAction ); - if ( $wgLoginLanguageSelector ) { + if ( $wgLoginLanguageSelector && $this->mLanguage ) { $form->addHiddenField( 'uselang', $this->mLanguage ); } $form->addHiddenField( 'force', $this->securityLevel ); @@ -655,7 +659,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { // make a best effort to get the value of fields which used to be fixed in the old login // template but now might or might not exist depending on what providers are used $request = $this->getRequest(); - $data = (object) [ + $data = (object)[ 'mUsername' => $request->getText( 'wpName' ), 'mPassword' => $request->getText( 'wpPassword' ), 'mRetype' => $request->getText( 'wpRetype' ), @@ -759,14 +763,21 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $wgAuth->modifyUITemplate( $template, $action ); $oldTemplate = $template; - $hookName = $this->isSignup() ? 'UserCreateForm' : 'UserLoginForm'; - Hooks::run( $hookName, [ &$template ] ); - if ( $oldTemplate !== $template ) { - wfDeprecated( "reference in $hookName hook", '1.27' ); + + // Both Hooks::run are explicit here to make findHooks.php happy + if ( $this->isSignup() ) { + Hooks::run( 'UserCreateForm', [ &$template ] ); + if ( $oldTemplate !== $template ) { + wfDeprecated( "reference in UserCreateForm hook", '1.27' ); + } + } else { + Hooks::run( 'UserLoginForm', [ &$template ] ); + if ( $oldTemplate !== $template ) { + wfDeprecated( "reference in UserLoginForm hook", '1.27' ); + } } return $template; - } public function onAuthChangeFormFields( @@ -1070,7 +1081,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { } if ( !$this->isSignup() && $this->showExtraInformation() ) { $passwordReset = new PasswordReset( $this->getConfig(), AuthManager::singleton() ); - if ( $passwordReset->isAllowed( $this->getUser() ) ) { + if ( $passwordReset->isAllowed( $this->getUser() )->isGood() ) { $fieldDefinitions['passwordReset'] = [ 'type' => 'info', 'raw' => true,