X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecialpage%2FLoginSignupSpecialPage.php;h=9d6fd5bad032bca29b62cf67ed27682a43eb6202;hp=c3ee32120b285eb511249fd92fa8108bfdecf146;hb=1e8f417f3d6d648e19c03465890b58a331514362;hpb=892b17237bb44630fa6f508c5bf85374a62def13 diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index c3ee32120b..9d6fd5bad0 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -26,7 +26,9 @@ use MediaWiki\Auth\AuthenticationResponse; use MediaWiki\Auth\AuthManager; use MediaWiki\Auth\Throttler; use MediaWiki\Logger\LoggerFactory; +use MediaWiki\MediaWikiServices; use MediaWiki\Session\SessionManager; +use Wikimedia\ScopedCallback; /** * Holds shared logic for login and account creation pages. @@ -177,7 +179,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { # 1. When switching accounts, it sucks to get automatically logged out # 2. Do not return to PasswordReset after a successful password change - # but goto Wiki start page (Main_Page) instead ( bug 33997 ) + # but goto Wiki start page (Main_Page) instead ( T35997 ) $returnToTitle = Title::newFromText( $this->mReturnTo ); if ( is_object( $returnToTitle ) && ( $returnToTitle->isSpecial( 'Userlogout' ) @@ -212,6 +214,15 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { * @param string|null $subPage */ public function execute( $subPage ) { + if ( $this->mPosted ) { + $time = microtime( true ); + $profilingScope = new ScopedCallback( function () use ( $time ) { + $time = microtime( true ) - $time; + $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory(); + $statsd->timing( "timing.login.ui.{$this->authAction}", $time * 1000 ); + } ); + } + $authManager = AuthManager::singleton(); $session = SessionManager::getGlobalSession(); @@ -702,7 +713,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { */ protected function getFakeTemplate( $msg, $msgType ) { global $wgAuth, $wgEnableEmail, $wgHiddenPrefs, $wgEmailConfirmToEdit, $wgEnableUserEmail, - $wgSecureLogin, $wgPasswordResetRoutes; + $wgSecureLogin, $wgPasswordResetRoutes; // 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 @@ -727,7 +738,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $user = $this->getUser(); $template = new FakeAuthTemplate(); - // Pre-fill username (if not creating an account, bug 44775). + // Pre-fill username (if not creating an account, T46775). if ( $data->mUsername == '' && $this->isSignup() ) { if ( $user->isLoggedIn() ) { $data->mUsername = $user->getName(); @@ -761,7 +772,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { if ( $this->showCreateAccountLink() ) { # Pass any language selection on to the mode switch link if ( $this->mLanguage ) { - $linkq .= '&uselang=' . $this->mLanguage; + $linkq .= '&uselang=' . urlencode( $this->mLanguage ); } // Supply URL, login template creates the button. $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) ); @@ -772,7 +783,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $resetLink = $this->isSignup() ? null : is_array( $wgPasswordResetRoutes ) - && in_array( true, array_values( $wgPasswordResetRoutes ), true ); + && in_array( true, array_values( $wgPasswordResetRoutes ), true ); $template->set( 'header', '' ); $template->set( 'formheader', '' ); @@ -1149,7 +1160,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage { $linkq = $this->getReturnToQueryStringFragment(); // Pass any language selection on to the mode switch link if ( $this->mLanguage ) { - $linkq .= '&uselang=' . $this->mLanguage; + $linkq .= '&uselang=' . urlencode( $this->mLanguage ); } $loggedIn = $this->getUser()->isLoggedIn();