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.
/**
* Load basic request parameters for this Special page.
- * @param $subPage
+ * @param string $subPage
*/
private function loadRequestParameters( $subPage ) {
if ( $this->mLoadedRequest ) {
* @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();
*/
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
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 ) );
$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', '' );
// Don't show a "create account" link if the user can't.
if ( $this->showCreateAccountLink() ) {
// link to the other action
- $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' :'CreateAccount' );
+ $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' : 'CreateAccount' );
$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();
/**
* Adds fields provided via the deprecated UserLoginForm / UserCreateForm hooks
- * @param $fieldDefinitions array
+ * @param array $fieldDefinitions
* @param FakeAuthTemplate $template
* @return array
*/
}
/**
- * @param array $formDescriptor
+ * @param array &$formDescriptor
*/
protected function postProcessFormDescriptor( &$formDescriptor, $requests ) {
// Pre-fill username (if not creating an account, T46775).