MediaWiki  master
LoginSignupSpecialPage.php
Go to the documentation of this file.
1 <?php
30 use Wikimedia\ScopedCallback;
31 
38  protected $mReturnTo;
39  protected $mPosted;
40  protected $mAction;
41  protected $mLanguage;
42  protected $mReturnToQuery;
43  protected $mToken;
44  protected $mStickHTTPS;
45  protected $mFromHTTP;
46  protected $mEntryError = '';
47  protected $mEntryErrorType = 'error';
48 
49  protected $mLoaded = false;
50  protected $mLoadedRequest = false;
51  protected $mSecureLoginUrl;
52  private $reasonValidatorResult = null;
53 
55  protected $securityLevel;
56 
62  protected $targetUser;
63 
65  protected $authForm;
66 
67  abstract protected function isSignup();
68 
75  abstract protected function successfulAction( $direct = false, $extraMessages = null );
76 
82  abstract protected function logAuthResult( $success, $status = null );
83 
84  public function __construct( $name ) {
86  parent::__construct( $name );
87 
88  // Override UseMediaWikiEverywhere to true, to force login and create form to use mw ui
90  }
91 
92  protected function setRequest( array $data, $wasPosted = null ) {
93  parent::setRequest( $data, $wasPosted );
94  $this->mLoadedRequest = false;
95  }
96 
100  private function loadRequestParameters() {
101  if ( $this->mLoadedRequest ) {
102  return;
103  }
104  $this->mLoadedRequest = true;
105  $request = $this->getRequest();
106 
107  $this->mPosted = $request->wasPosted();
108  $this->mAction = $request->getVal( 'action' );
109  $this->mFromHTTP = $request->getBool( 'fromhttp', false )
110  || $request->getBool( 'wpFromhttp', false );
111  $this->mStickHTTPS = ( !$this->mFromHTTP && $request->getProtocol() === 'https' )
112  || $request->getBool( 'wpForceHttps', false );
113  $this->mLanguage = $request->getText( 'uselang' );
114  $this->mReturnTo = $request->getVal( 'returnto', '' );
115  $this->mReturnToQuery = $request->getVal( 'returntoquery', '' );
116  }
117 
123  protected function load( $subPage ) {
124  global $wgSecureLogin;
125 
126  $this->loadRequestParameters();
127  if ( $this->mLoaded ) {
128  return;
129  }
130  $this->mLoaded = true;
131  $request = $this->getRequest();
132 
133  $securityLevel = $this->getRequest()->getText( 'force' );
134  if (
135  $securityLevel && AuthManager::singleton()->securitySensitiveOperationStatus(
136  $securityLevel ) === AuthManager::SEC_REAUTH
137  ) {
138  $this->securityLevel = $securityLevel;
139  }
140 
141  $this->loadAuth( $subPage );
142 
143  $this->mToken = $request->getVal( $this->getTokenName() );
144 
145  // Show an error or warning passed on from a previous page
146  $entryError = $this->msg( $request->getVal( 'error', '' ) );
147  $entryWarning = $this->msg( $request->getVal( 'warning', '' ) );
148  // bc: provide login link as a parameter for messages where the translation
149  // was not updated
150  $loginreqlink = $this->getLinkRenderer()->makeKnownLink(
151  $this->getPageTitle(),
152  $this->msg( 'loginreqlink' )->text(),
153  [],
154  [
155  'returnto' => $this->mReturnTo,
156  'returntoquery' => $this->mReturnToQuery,
157  'uselang' => $this->mLanguage ?: null,
158  'fromhttp' => $wgSecureLogin && $this->mFromHTTP ? '1' : null,
159  ]
160  );
161 
162  // Only show valid error or warning messages.
163  if ( $entryError->exists()
164  && in_array( $entryError->getKey(), LoginHelper::getValidErrorMessages(), true )
165  ) {
166  $this->mEntryErrorType = 'error';
167  $this->mEntryError = $entryError->rawParams( $loginreqlink )->parse();
168 
169  } elseif ( $entryWarning->exists()
170  && in_array( $entryWarning->getKey(), LoginHelper::getValidErrorMessages(), true )
171  ) {
172  $this->mEntryErrorType = 'warning';
173  $this->mEntryError = $entryWarning->rawParams( $loginreqlink )->parse();
174  }
175 
176  # 1. When switching accounts, it sucks to get automatically logged out
177  # 2. Do not return to PasswordReset after a successful password change
178  # but goto Wiki start page (Main_Page) instead ( T35997 )
179  $returnToTitle = Title::newFromText( $this->mReturnTo );
180  if ( is_object( $returnToTitle )
181  && ( $returnToTitle->isSpecial( 'Userlogout' )
182  || $returnToTitle->isSpecial( 'PasswordReset' ) )
183  ) {
184  $this->mReturnTo = '';
185  $this->mReturnToQuery = '';
186  }
187  }
188 
189  protected function getPreservedParams( $withToken = false ) {
190  global $wgSecureLogin;
191 
192  $params = parent::getPreservedParams( $withToken );
193  $params += [
194  'returnto' => $this->mReturnTo ?: null,
195  'returntoquery' => $this->mReturnToQuery ?: null,
196  ];
197  if ( $wgSecureLogin && !$this->isSignup() ) {
198  $params['fromhttp'] = $this->mFromHTTP ? '1' : null;
199  }
200  return $params;
201  }
202 
203  protected function beforeExecute( $subPage ) {
204  // finish initializing the class before processing the request - T135924
205  $this->loadRequestParameters();
206  return parent::beforeExecute( $subPage );
207  }
208 
213  public function execute( $subPage ) {
214  if ( $this->mPosted ) {
215  $time = microtime( true );
216  $profilingScope = new ScopedCallback( function () use ( $time ) {
217  $time = microtime( true ) - $time;
218  $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
219  $statsd->timing( "timing.login.ui.{$this->authAction}", $time * 1000 );
220  } );
221  }
222 
223  $authManager = AuthManager::singleton();
224  $session = SessionManager::getGlobalSession();
225 
226  // Session data is used for various things in the authentication process, so we must make
227  // sure a session cookie or some equivalent mechanism is set.
228  $session->persist();
229  // Explicitly disable cache to ensure cookie blocks may be set (T152462).
230  // (Technically redundant with sessions persisting from this page.)
231  $this->getOutput()->enableClientCache( false );
232 
233  $this->load( $subPage );
234  $this->setHeaders();
235  $this->checkPermissions();
236 
237  // Make sure the system configuration allows log in / sign up
238  if ( !$this->isSignup() && !$authManager->canAuthenticateNow() ) {
239  if ( !$session->canSetUser() ) {
240  throw new ErrorPageError( 'cannotloginnow-title', 'cannotloginnow-text', [
241  $session->getProvider()->describe( RequestContext::getMain()->getLanguage() )
242  ] );
243  }
244  throw new ErrorPageError( 'cannotlogin-title', 'cannotlogin-text' );
245  } elseif ( $this->isSignup() && !$authManager->canCreateAccounts() ) {
246  throw new ErrorPageError( 'cannotcreateaccount-title', 'cannotcreateaccount-text' );
247  }
248 
249  /*
250  * In the case where the user is already logged in, and was redirected to
251  * the login form from a page that requires login, do not show the login
252  * page. The use case scenario for this is when a user opens a large number
253  * of tabs, is redirected to the login page on all of them, and then logs
254  * in on one, expecting all the others to work properly.
255  *
256  * However, do show the form if it was visited intentionally (no 'returnto'
257  * is present). People who often switch between several accounts have grown
258  * accustomed to this behavior.
259  *
260  * Also make an exception when force=<level> is set in the URL, which means the user must
261  * reauthenticate for security reasons.
262  */
263  if ( !$this->isSignup() && !$this->mPosted && !$this->securityLevel &&
264  ( $this->mReturnTo !== '' || $this->mReturnToQuery !== '' ) &&
265  $this->getUser()->isLoggedIn()
266  ) {
267  $this->successfulAction();
268  return;
269  }
270 
271  // If logging in and not on HTTPS, either redirect to it or offer a link.
272  global $wgSecureLogin;
273  if ( $this->getRequest()->getProtocol() !== 'https' ) {
274  $title = $this->getFullTitle();
275  $query = $this->getPreservedParams( false ) + [
276  'title' => null,
277  ( $this->mEntryErrorType === 'error' ? 'error'
278  : 'warning' ) => $this->mEntryError,
279  ] + $this->getRequest()->getQueryValues();
280  $url = $title->getFullURL( $query, false, PROTO_HTTPS );
281  if ( $wgSecureLogin && !$this->mFromHTTP &&
282  wfCanIPUseHTTPS( $this->getRequest()->getIP() )
283  ) {
284  // Avoid infinite redirect
285  $url = wfAppendQuery( $url, 'fromhttp=1' );
286  $this->getOutput()->redirect( $url );
287  // Since we only do this redir to change proto, always vary
288  $this->getOutput()->addVaryHeader( 'X-Forwarded-Proto' );
289 
290  return;
291  } else {
292  // A wiki without HTTPS login support should set $wgServer to
293  // http://somehost, in which case the secure URL generated
294  // above won't actually start with https://
295  if ( substr( $url, 0, 8 ) === 'https://' ) {
296  $this->mSecureLoginUrl = $url;
297  }
298  }
299  }
300 
301  if ( !$this->isActionAllowed( $this->authAction ) ) {
302  // FIXME how do we explain this to the user? can we handle session loss better?
303  // messages used: authpage-cannot-login, authpage-cannot-login-continue,
304  // authpage-cannot-create, authpage-cannot-create-continue
305  $this->mainLoginForm( [], 'authpage-cannot-' . $this->authAction );
306  return;
307  }
308 
309  if ( $this->canBypassForm( $button_name ) ) {
310  $this->setRequest( [], true );
311  $this->getRequest()->setVal( $this->getTokenName(), $this->getToken() );
312  if ( $button_name ) {
313  $this->getRequest()->setVal( $button_name, true );
314  }
315  }
316 
317  $status = $this->trySubmit();
318 
319  if ( !$status || !$status->isGood() ) {
320  $this->mainLoginForm( $this->authRequests, $status ? $status->getMessage() : '', 'error' );
321  return;
322  }
323 
325  $response = $status->getValue();
326 
327  $returnToUrl = $this->getPageTitle( 'return' )
328  ->getFullURL( $this->getPreservedParams( true ), false, PROTO_HTTPS );
329  switch ( $response->status ) {
330  case AuthenticationResponse::PASS:
331  $this->logAuthResult( true );
332  $this->proxyAccountCreation = $this->isSignup() && !$this->getUser()->isAnon();
333  $this->targetUser = User::newFromName( $response->username );
334 
335  if (
336  !$this->proxyAccountCreation
337  && $response->loginRequest
338  && $authManager->canAuthenticateNow()
339  ) {
340  // successful registration; log the user in instantly
341  $response2 = $authManager->beginAuthentication( [ $response->loginRequest ],
342  $returnToUrl );
343  if ( $response2->status !== AuthenticationResponse::PASS ) {
344  LoggerFactory::getInstance( 'login' )
345  ->error( 'Could not log in after account creation' );
346  $this->successfulAction( true, Status::newFatal( 'createacct-loginerror' ) );
347  break;
348  }
349  }
350 
351  if ( !$this->proxyAccountCreation ) {
352  // Ensure that the context user is the same as the session user.
354  }
355 
356  $this->successfulAction( true );
357  break;
358  case AuthenticationResponse::FAIL:
359  // fall through
360  case AuthenticationResponse::RESTART:
361  unset( $this->authForm );
362  if ( $response->status === AuthenticationResponse::FAIL ) {
363  $action = $this->getDefaultAction( $subPage );
364  $messageType = 'error';
365  } else {
366  $action = $this->getContinueAction( $this->authAction );
367  $messageType = 'warning';
368  }
369  $this->logAuthResult( false, $response->message ? $response->message->getKey() : '-' );
370  $this->loadAuth( $subPage, $action, true );
371  $this->mainLoginForm( $this->authRequests, $response->message, $messageType );
372  break;
373  case AuthenticationResponse::REDIRECT:
374  unset( $this->authForm );
375  $this->getOutput()->redirect( $response->redirectTarget );
376  break;
377  case AuthenticationResponse::UI:
378  unset( $this->authForm );
379  $this->authAction = $this->isSignup() ? AuthManager::ACTION_CREATE_CONTINUE
380  : AuthManager::ACTION_LOGIN_CONTINUE;
381  $this->authRequests = $response->neededRequests;
382  $this->mainLoginForm( $response->neededRequests, $response->message, $response->messageType );
383  break;
384  default:
385  throw new LogicException( 'invalid AuthenticationResponse' );
386  }
387  }
388 
402  private function canBypassForm( &$button_name ) {
403  $button_name = null;
404  if ( $this->isContinued() ) {
405  return false;
406  }
407  $fields = AuthenticationRequest::mergeFieldInfo( $this->authRequests );
408  foreach ( $fields as $fieldname => $field ) {
409  if ( !isset( $field['type'] ) ) {
410  return false;
411  }
412  if ( !empty( $field['skippable'] ) ) {
413  continue;
414  }
415  if ( $field['type'] === 'button' ) {
416  if ( $button_name !== null ) {
417  $button_name = null;
418  return false;
419  } else {
420  $button_name = $fieldname;
421  }
422  } elseif ( $field['type'] !== 'null' ) {
423  return false;
424  }
425  }
426  return true;
427  }
428 
438  protected function showSuccessPage(
439  $type, $title, $msgname, $injected_html, $extraMessages
440  ) {
441  $out = $this->getOutput();
442  $out->setPageTitle( $title );
443  if ( $msgname ) {
444  $out->addWikiMsg( $msgname, wfEscapeWikiText( $this->getUser()->getName() ) );
445  }
446  if ( $extraMessages ) {
447  $extraMessages = Status::wrap( $extraMessages );
448  $out->addWikiTextAsInterface(
449  $extraMessages->getWikiText( false, false, $this->getLanguage() )
450  );
451  }
452 
453  $out->addHTML( $injected_html );
454 
455  $helper = new LoginHelper( $this->getContext() );
456  $helper->showReturnToPage( $type, $this->mReturnTo, $this->mReturnToQuery, $this->mStickHTTPS );
457  }
458 
474  public function showReturnToPage(
475  $type, $returnTo = '', $returnToQuery = '', $stickHTTPS = false
476  ) {
477  $helper = new LoginHelper( $this->getContext() );
478  $helper->showReturnToPage( $type, $returnTo, $returnToQuery, $stickHTTPS );
479  }
480 
485  protected function setSessionUserForCurrentRequest() {
486  global $wgUser, $wgLang;
487 
489  $localContext = $this->getContext();
490  if ( $context !== $localContext ) {
491  // remove AuthManagerSpecialPage context hack
492  $this->setContext( $context );
493  }
494 
495  $user = $context->getRequest()->getSession()->getUser();
496 
497  $wgUser = $user;
498  $context->setUser( $user );
499 
500  $wgLang = $context->getLanguage();
501  }
502 
517  protected function mainLoginForm( array $requests, $msg = '', $msgtype = 'error' ) {
518  $user = $this->getUser();
519  $out = $this->getOutput();
520 
521  // FIXME how to handle empty $requests - restart, or no form, just an error message?
522  // no form would be better for no session type errors, restart is better when can* fails.
523  if ( !$requests ) {
524  $this->authAction = $this->getDefaultAction( $this->subPage );
525  $this->authForm = null;
526  $requests = AuthManager::singleton()->getAuthenticationRequests( $this->authAction, $user );
527  }
528 
529  // Generic styles and scripts for both login and signup form
530  $out->addModuleStyles( [
531  'mediawiki.ui',
532  'mediawiki.ui.button',
533  'mediawiki.ui.checkbox',
534  'mediawiki.ui.input',
535  'mediawiki.special.userlogin.common.styles'
536  ] );
537  if ( $this->isSignup() ) {
538  // XXX hack pending RL or JS parse() support for complex content messages T27349
539  $out->addJsConfigVars( 'wgCreateacctImgcaptchaHelp',
540  $this->msg( 'createacct-imgcaptcha-help' )->parse() );
541 
542  // Additional styles and scripts for signup form
543  $out->addModules( [
544  'mediawiki.special.userlogin.signup.js'
545  ] );
546  $out->addModuleStyles( [
547  'mediawiki.special.userlogin.signup.styles'
548  ] );
549  } else {
550  // Additional styles for login form
551  $out->addModuleStyles( [
552  'mediawiki.special.userlogin.login.styles'
553  ] );
554  }
555  $out->disallowUserJs(); // just in case...
556 
557  $form = $this->getAuthForm( $requests, $this->authAction, $msg, $msgtype );
558  $form->prepareForm();
559 
560  $submitStatus = Status::newGood();
561  if ( $msg && $msgtype === 'warning' ) {
562  $submitStatus->warning( $msg );
563  } elseif ( $msg && $msgtype === 'error' ) {
564  $submitStatus->fatal( $msg );
565  }
566 
567  // warning header for non-standard workflows (e.g. security reauthentication)
568  if (
569  !$this->isSignup() &&
570  $this->getUser()->isLoggedIn() &&
571  $this->authAction !== AuthManager::ACTION_LOGIN_CONTINUE
572  ) {
573  $reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin';
574  $submitStatus->warning( $reauthMessage, $this->getUser()->getName() );
575  }
576 
577  $formHtml = $form->getHTML( $submitStatus );
578 
579  $out->addHTML( $this->getPageHtml( $formHtml ) );
580  }
581 
588  protected function getPageHtml( $formHtml ) {
590 
591  $loginPrompt = $this->isSignup() ? '' : Html::rawElement( 'div',
592  [ 'id' => 'userloginprompt' ], $this->msg( 'loginprompt' )->parseAsBlock() );
593  $languageLinks = $wgLoginLanguageSelector ? $this->makeLanguageSelector() : '';
594  $signupStartMsg = $this->msg( 'signupstart' );
595  $signupStart = ( $this->isSignup() && !$signupStartMsg->isDisabled() )
596  ? Html::rawElement( 'div', [ 'id' => 'signupstart' ], $signupStartMsg->parseAsBlock() ) : '';
597  if ( $languageLinks ) {
598  $languageLinks = Html::rawElement( 'div', [ 'id' => 'languagelinks' ],
599  Html::rawElement( 'p', [], $languageLinks )
600  );
601  }
602 
603  $benefitsContainer = '';
604  if ( $this->isSignup() && $this->showExtraInformation() ) {
605  // messages used:
606  // createacct-benefit-icon1 createacct-benefit-head1 createacct-benefit-body1
607  // createacct-benefit-icon2 createacct-benefit-head2 createacct-benefit-body2
608  // createacct-benefit-icon3 createacct-benefit-head3 createacct-benefit-body3
609  $benefitCount = 3;
610  $benefitList = '';
611  for ( $benefitIdx = 1; $benefitIdx <= $benefitCount; $benefitIdx++ ) {
612  $headUnescaped = $this->msg( "createacct-benefit-head$benefitIdx" )->text();
613  $iconClass = $this->msg( "createacct-benefit-icon$benefitIdx" )->text();
614  $benefitList .= Html::rawElement( 'div', [ 'class' => "mw-number-text $iconClass" ],
615  Html::rawElement( 'h3', [],
616  $this->msg( "createacct-benefit-head$benefitIdx" )->escaped()
617  )
618  . Html::rawElement( 'p', [],
619  $this->msg( "createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped()
620  )
621  );
622  }
623  $benefitsContainer = Html::rawElement( 'div', [ 'class' => 'mw-createacct-benefits-container' ],
624  Html::rawElement( 'h2', [], $this->msg( 'createacct-benefit-heading' )->escaped() )
625  . Html::rawElement( 'div', [ 'class' => 'mw-createacct-benefits-list' ],
626  $benefitList
627  )
628  );
629  }
630 
631  $html = Html::rawElement( 'div', [ 'class' => 'mw-ui-container' ],
632  $loginPrompt
633  . $languageLinks
634  . $signupStart
635  . Html::rawElement( 'div', [ 'id' => 'userloginForm' ],
636  $formHtml
637  )
638  . $benefitsContainer
639  );
640 
641  return $html;
642  }
643 
652  protected function getAuthForm( array $requests, $action, $msg = '', $msgType = 'error' ) {
653  global $wgSecureLogin;
654  // FIXME merge this with parent
655 
656  if ( isset( $this->authForm ) ) {
657  return $this->authForm;
658  }
659 
660  $usingHTTPS = $this->getRequest()->getProtocol() === 'https';
661 
662  // get basic form description from the auth logic
663  $fieldInfo = AuthenticationRequest::mergeFieldInfo( $requests );
664  // this will call onAuthChangeFormFields()
665  $formDescriptor = static::fieldInfoToFormDescriptor( $requests, $fieldInfo, $this->authAction );
666  $this->postProcessFormDescriptor( $formDescriptor, $requests );
667 
668  $context = $this->getContext();
669  if ( $context->getRequest() !== $this->getRequest() ) {
670  // We have overridden the request, need to make sure the form uses that too.
671  $context = new DerivativeContext( $this->getContext() );
672  $context->setRequest( $this->getRequest() );
673  }
674  $form = HTMLForm::factory( 'vform', $formDescriptor, $context );
675 
676  $form->addHiddenField( 'authAction', $this->authAction );
677  if ( $this->mLanguage ) {
678  $form->addHiddenField( 'uselang', $this->mLanguage );
679  }
680  $form->addHiddenField( 'force', $this->securityLevel );
681  $form->addHiddenField( $this->getTokenName(), $this->getToken()->toString() );
682  if ( $wgSecureLogin ) {
683  // If using HTTPS coming from HTTP, then the 'fromhttp' parameter must be preserved
684  if ( !$this->isSignup() ) {
685  $form->addHiddenField( 'wpForceHttps', (int)$this->mStickHTTPS );
686  $form->addHiddenField( 'wpFromhttp', $usingHTTPS );
687  }
688  }
689 
690  // set properties of the form itself
691  $form->setAction( $this->getPageTitle()->getLocalURL( $this->getReturnToQueryStringFragment() ) );
692  $form->setName( 'userlogin' . ( $this->isSignup() ? '2' : '' ) );
693  if ( $this->isSignup() ) {
694  $form->setId( 'userlogin2' );
695  }
696 
697  $form->suppressDefaultSubmit();
698 
699  $this->authForm = $form;
700 
701  return $form;
702  }
703 
704  public function onAuthChangeFormFields(
705  array $requests, array $fieldInfo, array &$formDescriptor, $action
706  ) {
707  $coreFieldDescriptors = $this->getFieldDefinitions();
708 
709  // keep the ordering from getCoreFieldDescriptors() where there is no explicit weight
710  foreach ( $coreFieldDescriptors as $fieldName => $coreField ) {
711  $requestField = $formDescriptor[$fieldName] ?? [];
712 
713  // remove everything that is not in the fieldinfo, is not marked as a supplemental field
714  // to something in the fieldinfo, and is not an info field or a submit button
715  if (
716  !isset( $fieldInfo[$fieldName] )
717  && (
718  !isset( $coreField['baseField'] )
719  || !isset( $fieldInfo[$coreField['baseField']] )
720  )
721  && (
722  !isset( $coreField['type'] )
723  || !in_array( $coreField['type'], [ 'submit', 'info' ], true )
724  )
725  ) {
726  $coreFieldDescriptors[$fieldName] = null;
727  continue;
728  }
729 
730  // core message labels should always take priority
731  if (
732  isset( $coreField['label'] )
733  || isset( $coreField['label-message'] )
734  || isset( $coreField['label-raw'] )
735  ) {
736  unset( $requestField['label'], $requestField['label-message'], $coreField['label-raw'] );
737  }
738 
739  $coreFieldDescriptors[$fieldName] += $requestField;
740  }
741 
742  $formDescriptor = array_filter( $coreFieldDescriptors + $formDescriptor );
743  return true;
744  }
745 
752  protected function showExtraInformation() {
753  return $this->authAction !== $this->getContinueAction( $this->authAction )
755  }
756 
761  protected function getFieldDefinitions() {
762  global $wgEmailConfirmToEdit;
763 
764  $isLoggedIn = $this->getUser()->isLoggedIn();
765  $continuePart = $this->isContinued() ? 'continue-' : '';
766  $anotherPart = $isLoggedIn ? 'another-' : '';
767  // @phan-suppress-next-line PhanUndeclaredMethod
768  $expiration = $this->getRequest()->getSession()->getProvider()->getRememberUserDuration();
769  $expirationDays = ceil( $expiration / ( 3600 * 24 ) );
770  $secureLoginLink = '';
771  if ( $this->mSecureLoginUrl ) {
772  $secureLoginLink = Html::element( 'a', [
773  'href' => $this->mSecureLoginUrl,
774  'class' => 'mw-ui-flush-right mw-secure',
775  ], $this->msg( 'userlogin-signwithsecure' )->text() );
776  }
777  $usernameHelpLink = '';
778  if ( !$this->msg( 'createacct-helpusername' )->isDisabled() ) {
779  $usernameHelpLink = Html::rawElement( 'span', [
780  'class' => 'mw-ui-flush-right',
781  ], $this->msg( 'createacct-helpusername' )->parse() );
782  }
783 
784  if ( $this->isSignup() ) {
785  $fieldDefinitions = [
786  'statusarea' => [
787  // used by the mediawiki.special.userlogin.signup.js module for error display
788  // FIXME merge this with HTMLForm's normal status (error) area
789  'type' => 'info',
790  'raw' => true,
791  'default' => Html::element( 'div', [ 'id' => 'mw-createacct-status-area' ] ),
792  'weight' => -105,
793  ],
794  'username' => [
795  'label-raw' => $this->msg( 'userlogin-yourname' )->escaped() . $usernameHelpLink,
796  'id' => 'wpName2',
797  'placeholder-message' => $isLoggedIn ? 'createacct-another-username-ph'
798  : 'userlogin-yourname-ph',
799  ],
800  'mailpassword' => [
801  // create account without providing password, a temporary one will be mailed
802  'type' => 'check',
803  'label-message' => 'createaccountmail',
804  'name' => 'wpCreateaccountMail',
805  'id' => 'wpCreateaccountMail',
806  ],
807  'password' => [
808  'id' => 'wpPassword2',
809  'placeholder-message' => 'createacct-yourpassword-ph',
810  'hide-if' => [ '===', 'wpCreateaccountMail', '1' ],
811  ],
812  'domain' => [],
813  'retype' => [
814  'baseField' => 'password',
815  'type' => 'password',
816  'label-message' => 'createacct-yourpasswordagain',
817  'id' => 'wpRetype',
818  'cssclass' => 'loginPassword',
819  'size' => 20,
820  'validation-callback' => function ( $value, $alldata ) {
821  if ( empty( $alldata['mailpassword'] ) && !empty( $alldata['password'] ) ) {
822  if ( !$value ) {
823  return $this->msg( 'htmlform-required' );
824  } elseif ( $value !== $alldata['password'] ) {
825  return $this->msg( 'badretype' );
826  }
827  }
828  return true;
829  },
830  'hide-if' => [ '===', 'wpCreateaccountMail', '1' ],
831  'placeholder-message' => 'createacct-yourpasswordagain-ph',
832  ],
833  'email' => [
834  'type' => 'email',
835  'label-message' => $wgEmailConfirmToEdit ? 'createacct-emailrequired'
836  : 'createacct-emailoptional',
837  'id' => 'wpEmail',
838  'cssclass' => 'loginText',
839  'size' => '20',
840  // FIXME will break non-standard providers
841  'required' => $wgEmailConfirmToEdit,
842  'validation-callback' => function ( $value, $alldata ) {
843  global $wgEmailConfirmToEdit;
844 
845  // AuthManager will check most of these, but that will make the auth
846  // session fail and this won't, so nicer to do it this way
847  if ( !$value && $wgEmailConfirmToEdit ) {
848  // no point in allowing registration without email when email is
849  // required to edit
850  return $this->msg( 'noemailtitle' );
851  } elseif ( !$value && !empty( $alldata['mailpassword'] ) ) {
852  // cannot send password via email when there is no email address
853  return $this->msg( 'noemailcreate' );
854  } elseif ( $value && !Sanitizer::validateEmail( $value ) ) {
855  return $this->msg( 'invalidemailaddress' );
856  }
857  return true;
858  },
859  'placeholder-message' => 'createacct-' . $anotherPart . 'email-ph',
860  ],
861  'realname' => [
862  'type' => 'text',
863  'help-message' => $isLoggedIn ? 'createacct-another-realname-tip'
864  : 'prefs-help-realname',
865  'label-message' => 'createacct-realname',
866  'cssclass' => 'loginText',
867  'size' => 20,
868  'id' => 'wpRealName',
869  ],
870  'reason' => [
871  // comment for the user creation log
872  'type' => 'text',
873  'label-message' => 'createacct-reason',
874  'cssclass' => 'loginText',
875  'id' => 'wpReason',
876  'size' => '20',
877  'validation-callback' => function ( $value, $alldata ) {
878  // if the user sets an email address as the user creation reason, confirm that
879  // that was their intent
880  if ( $value && Sanitizer::validateEmail( $value ) ) {
881  if ( $this->reasonValidatorResult !== null ) {
883  }
884  $this->reasonValidatorResult = true;
885  if ( !AuthManager::singleton()->getAuthenticationSessionData( 'reason-retry', false ) ) {
886  AuthManager::singleton()->setAuthenticationSessionData( 'reason-retry', true );
887  $this->reasonValidatorResult = $this->msg( 'createacct-reason-confirm' );
888  }
890  }
891  return true;
892  },
893  'placeholder-message' => 'createacct-reason-ph',
894  ],
895  'createaccount' => [
896  // submit button
897  'type' => 'submit',
898  'default' => $this->msg( 'createacct-' . $anotherPart . $continuePart .
899  'submit' )->text(),
900  'name' => 'wpCreateaccount',
901  'id' => 'wpCreateaccount',
902  'weight' => 100,
903  ],
904  ];
905  } else {
906  $fieldDefinitions = [
907  'username' => [
908  'label-raw' => $this->msg( 'userlogin-yourname' )->escaped() . $secureLoginLink,
909  'id' => 'wpName1',
910  'placeholder-message' => 'userlogin-yourname-ph',
911  ],
912  'password' => [
913  'id' => 'wpPassword1',
914  'placeholder-message' => 'userlogin-yourpassword-ph',
915  ],
916  'domain' => [],
917  'rememberMe' => [
918  // option for saving the user token to a cookie
919  'type' => 'check',
920  'cssclass' => 'mw-userlogin-rememberme',
921  'name' => 'wpRemember',
922  'label-message' => $this->msg( 'userlogin-remembermypassword' )
923  ->numParams( $expirationDays ),
924  'id' => 'wpRemember',
925  ],
926  'loginattempt' => [
927  // submit button
928  'type' => 'submit',
929  'default' => $this->msg( 'pt-login-' . $continuePart . 'button' )->text(),
930  'id' => 'wpLoginAttempt',
931  'weight' => 100,
932  ],
933  'linkcontainer' => [
934  // help link
935  'type' => 'info',
936  'cssclass' => 'mw-form-related-link-container mw-userlogin-help',
937  // 'id' => 'mw-userlogin-help', // FIXME HTMLInfoField ignores this
938  'raw' => true,
939  'default' => Html::element( 'a', [
940  'href' => Skin::makeInternalOrExternalUrl( $this->msg( 'helplogin-url' )
941  ->inContentLanguage()
942  ->text() ),
943  ], $this->msg( 'userlogin-helplink2' )->text() ),
944  'weight' => 200,
945  ],
946  // button for ResetPasswordSecondaryAuthenticationProvider
947  'skipReset' => [
948  'weight' => 110,
949  'flags' => [],
950  ],
951  ];
952  }
953 
954  $fieldDefinitions['username'] += [
955  'type' => 'text',
956  'name' => 'wpName',
957  'cssclass' => 'loginText',
958  'size' => 20,
959  // 'required' => true,
960  ];
961  $fieldDefinitions['password'] += [
962  'type' => 'password',
963  // 'label-message' => 'userlogin-yourpassword', // would override the changepassword label
964  'name' => 'wpPassword',
965  'cssclass' => 'loginPassword',
966  'size' => 20,
967  // 'required' => true,
968  ];
969 
970  if ( $this->mEntryError ) {
971  $fieldDefinitions['entryError'] = [
972  'type' => 'info',
973  'default' => Html::rawElement( 'div', [ 'class' => $this->mEntryErrorType . 'box', ],
974  $this->mEntryError ),
975  'raw' => true,
976  'rawrow' => true,
977  'weight' => -100,
978  ];
979  }
980  if ( !$this->showExtraInformation() ) {
981  unset( $fieldDefinitions['linkcontainer'], $fieldDefinitions['signupend'] );
982  }
983  if ( $this->isSignup() && $this->showExtraInformation() ) {
984  // blank signup footer for site customization
985  // uses signupend-https for HTTPS requests if it's not blank, signupend otherwise
986  $signupendMsg = $this->msg( 'signupend' );
987  $signupendHttpsMsg = $this->msg( 'signupend-https' );
988  if ( !$signupendMsg->isDisabled() ) {
989  $usingHTTPS = $this->getRequest()->getProtocol() === 'https';
990  $signupendText = ( $usingHTTPS && !$signupendHttpsMsg->isBlank() )
991  ? $signupendHttpsMsg->parse() : $signupendMsg->parse();
992  $fieldDefinitions['signupend'] = [
993  'type' => 'info',
994  'raw' => true,
995  'default' => Html::rawElement( 'div', [ 'id' => 'signupend' ], $signupendText ),
996  'weight' => 225,
997  ];
998  }
999  }
1000  if ( !$this->isSignup() && $this->showExtraInformation() ) {
1001  $passwordReset = MediaWikiServices::getInstance()->getPasswordReset();
1002  if ( $passwordReset->isAllowed( $this->getUser() )->isGood() ) {
1003  $fieldDefinitions['passwordReset'] = [
1004  'type' => 'info',
1005  'raw' => true,
1006  'cssclass' => 'mw-form-related-link-container',
1007  'default' => $this->getLinkRenderer()->makeLink(
1008  SpecialPage::getTitleFor( 'PasswordReset' ),
1009  $this->msg( 'userlogin-resetpassword-link' )->text()
1010  ),
1011  'weight' => 230,
1012  ];
1013  }
1014 
1015  // Don't show a "create account" link if the user can't.
1016  if ( $this->showCreateAccountLink() ) {
1017  // link to the other action
1018  $linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' : 'CreateAccount' );
1019  $linkq = $this->getReturnToQueryStringFragment();
1020  // Pass any language selection on to the mode switch link
1021  if ( $this->mLanguage ) {
1022  $linkq .= '&uselang=' . urlencode( $this->mLanguage );
1023  }
1024  $loggedIn = $this->getUser()->isLoggedIn();
1025 
1026  $fieldDefinitions['createOrLogin'] = [
1027  'type' => 'info',
1028  'raw' => true,
1029  'linkQuery' => $linkq,
1030  'default' => function ( $params ) use ( $loggedIn, $linkTitle ) {
1031  return Html::rawElement( 'div',
1032  [ 'id' => 'mw-createaccount' . ( !$loggedIn ? '-cta' : '' ),
1033  'class' => ( $loggedIn ? 'mw-form-related-link-container' : 'mw-ui-vform-field' ) ],
1034  ( $loggedIn ? '' : $this->msg( 'userlogin-noaccount' )->escaped() )
1035  . Html::element( 'a',
1036  [
1037  'id' => 'mw-createaccount-join' . ( $loggedIn ? '-loggedin' : '' ),
1038  'href' => $linkTitle->getLocalURL( $params['linkQuery'] ),
1039  'class' => ( $loggedIn ? '' : 'mw-ui-button' ),
1040  'tabindex' => 100,
1041  ],
1042  $this->msg(
1043  $loggedIn ? 'userlogin-createanother' : 'userlogin-joinproject'
1044  )->text()
1045  )
1046  );
1047  },
1048  'weight' => 235,
1049  ];
1050  }
1051  }
1052 
1053  return $fieldDefinitions;
1054  }
1055 
1065  protected function hasSessionCookie() {
1067 
1068  return $wgDisableCookieCheck || (
1070  $this->getRequest()->getSession()->getId() === (string)$wgInitialSessionId
1071  );
1072  }
1073 
1079  protected function getReturnToQueryStringFragment() {
1080  $returnto = '';
1081  if ( $this->mReturnTo !== '' ) {
1082  $returnto = 'returnto=' . wfUrlencode( $this->mReturnTo );
1083  if ( $this->mReturnToQuery !== '' ) {
1084  $returnto .= '&returntoquery=' . wfUrlencode( $this->mReturnToQuery );
1085  }
1086  }
1087  return $returnto;
1088  }
1089 
1095  private function showCreateAccountLink() {
1096  if ( $this->isSignup() ) {
1097  return true;
1098  } elseif ( MediaWikiServices::getInstance()
1100  ->userHasRight( $this->getUser(), 'createaccount' )
1101  ) {
1102  return true;
1103  } else {
1104  return false;
1105  }
1106  }
1107 
1108  protected function getTokenName() {
1109  return $this->isSignup() ? 'wpCreateaccountToken' : 'wpLoginToken';
1110  }
1111 
1118  protected function makeLanguageSelector() {
1119  $msg = $this->msg( 'loginlanguagelinks' )->inContentLanguage();
1120  if ( $msg->isBlank() ) {
1121  return '';
1122  }
1123  $langs = explode( "\n", $msg->text() );
1124  $links = [];
1125  foreach ( $langs as $lang ) {
1126  $lang = trim( $lang, '* ' );
1127  $parts = explode( '|', $lang );
1128  if ( count( $parts ) >= 2 ) {
1129  $links[] = $this->makeLanguageSelectorLink( $parts[0], trim( $parts[1] ) );
1130  }
1131  }
1132 
1133  return count( $links ) > 0 ? $this->msg( 'loginlanguagelabel' )->rawParams(
1134  $this->getLanguage()->pipeList( $links ) )->escaped() : '';
1135  }
1136 
1145  protected function makeLanguageSelectorLink( $text, $lang ) {
1146  if ( $this->getLanguage()->getCode() == $lang ) {
1147  // no link for currently used language
1148  return htmlspecialchars( $text );
1149  }
1150  $query = [ 'uselang' => $lang ];
1151  if ( $this->mReturnTo !== '' ) {
1152  $query['returnto'] = $this->mReturnTo;
1153  $query['returntoquery'] = $this->mReturnToQuery;
1154  }
1155 
1156  $attr = [];
1157  $targetLanguage = MediaWikiServices::getInstance()->getLanguageFactory()
1158  ->getLanguage( $lang );
1159  $attr['lang'] = $attr['hreflang'] = $targetLanguage->getHtmlCode();
1160 
1161  return $this->getLinkRenderer()->makeKnownLink(
1162  $this->getPageTitle(),
1163  $text,
1164  $attr,
1165  $query
1166  );
1167  }
1168 
1169  protected function getGroupName() {
1170  return 'login';
1171  }
1172 
1177  protected function postProcessFormDescriptor( &$formDescriptor, $requests ) {
1178  // Pre-fill username (if not creating an account, T46775).
1179  if (
1180  isset( $formDescriptor['username'] ) &&
1181  !isset( $formDescriptor['username']['default'] ) &&
1182  !$this->isSignup()
1183  ) {
1184  $user = $this->getUser();
1185  if ( $user->isLoggedIn() ) {
1186  $formDescriptor['username']['default'] = $user->getName();
1187  } else {
1188  $formDescriptor['username']['default'] =
1189  $this->getRequest()->getSession()->suggestLoginUsername();
1190  }
1191  }
1192 
1193  // don't show a submit button if there is nothing to submit (i.e. the only form content
1194  // is other submit buttons, for redirect flows)
1195  if ( !$this->needsSubmitButton( $requests ) ) {
1196  unset( $formDescriptor['createaccount'], $formDescriptor['loginattempt'] );
1197  }
1198 
1199  if ( !$this->isSignup() ) {
1200  // FIXME HACK don't focus on non-empty field
1201  // maybe there should be an autofocus-if similar to hide-if?
1202  if (
1203  isset( $formDescriptor['username'] )
1204  && empty( $formDescriptor['username']['default'] )
1205  && !$this->getRequest()->getCheck( 'wpName' )
1206  ) {
1207  $formDescriptor['username']['autofocus'] = true;
1208  } elseif ( isset( $formDescriptor['password'] ) ) {
1209  $formDescriptor['password']['autofocus'] = true;
1210  }
1211  }
1212 
1213  $this->addTabIndex( $formDescriptor );
1214  }
1215 }
LoginSignupSpecialPage\getTokenName
getTokenName()
Returns the name of the CSRF token (under which it should be found in the POST or GET data).
Definition: LoginSignupSpecialPage.php:1108
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:672
LoginSignupSpecialPage\$mEntryErrorType
$mEntryErrorType
Definition: LoginSignupSpecialPage.php:47
LoginSignupSpecialPage\setRequest
setRequest(array $data, $wasPosted=null)
Override the POST data, GET data from the real request is preserved.
Definition: LoginSignupSpecialPage.php:92
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:803
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:332
LoginSignupSpecialPage\postProcessFormDescriptor
postProcessFormDescriptor(&$formDescriptor, $requests)
Definition: LoginSignupSpecialPage.php:1177
wfCanIPUseHTTPS
wfCanIPUseHTTPS( $ip)
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS.
Definition: GlobalFunctions.php:2863
StatusValue\newFatal
static newFatal( $message,... $parameters)
Factory function for fatal errors.
Definition: StatusValue.php:69
LoginSignupSpecialPage\__construct
__construct( $name)
Definition: LoginSignupSpecialPage.php:84
AuthManagerSpecialPage\addTabIndex
addTabIndex(&$formDescriptor)
Adds a sequential tabindex starting from 1 to all form elements.
Definition: AuthManagerSpecialPage.php:605
$response
$response
Definition: opensearch_desc.php:44
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:719
LoginSignupSpecialPage\$mReturnTo
$mReturnTo
Definition: LoginSignupSpecialPage.php:38
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:137
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:37
LoginSignupSpecialPage\showSuccessPage
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
Definition: LoginSignupSpecialPage.php:438
LoginSignupSpecialPage\$mReturnToQuery
$mReturnToQuery
Definition: LoginSignupSpecialPage.php:42
true
return true
Definition: router.php:92
LoginSignupSpecialPage\showCreateAccountLink
showCreateAccountLink()
Whether the login/create account form should display a link to the other form (in addition to whateve...
Definition: LoginSignupSpecialPage.php:1095
LoginSignupSpecialPage\load
load( $subPage)
Load data from request.
Definition: LoginSignupSpecialPage.php:123
$wgUseMediaWikiUIEverywhere
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
Definition: DefaultSettings.php:3309
wfUrlencode
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
Definition: GlobalFunctions.php:309
SpecialPage\checkPermissions
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
Definition: SpecialPage.php:315
LoginSignupSpecialPage\makeLanguageSelectorLink
makeLanguageSelectorLink( $text, $lang)
Create a language selector link for a particular language Links back to this page preserving type and...
Definition: LoginSignupSpecialPage.php:1145
LoginSignupSpecialPage\beforeExecute
beforeExecute( $subPage)
Gets called before.
Definition: LoginSignupSpecialPage.php:203
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:535
LoginSignupSpecialPage\$mStickHTTPS
$mStickHTTPS
Definition: LoginSignupSpecialPage.php:44
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:83
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:749
$success
$success
Definition: NoLocalSettings.php:42
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:153
AuthManagerSpecialPage
A special page subclass for authentication-related special pages.
Definition: AuthManagerSpecialPage.php:14
LoginSignupSpecialPage\setSessionUserForCurrentRequest
setSessionUserForCurrentRequest()
Replace some globals to make sure the fact that the user has just been logged in is reflected in the ...
Definition: LoginSignupSpecialPage.php:485
LoginHelper
Helper functions for the login form that need to be shared with other special pages (such as CentralA...
Definition: LoginHelper.php:8
LoginSignupSpecialPage\getReturnToQueryStringFragment
getReturnToQueryStringFragment()
Returns a string that can be appended to the URL (without encoding) to preserve the return target.
Definition: LoginSignupSpecialPage.php:1079
AuthManagerSpecialPage\trySubmit
trySubmit()
Attempts to do an authentication step with the submitted data.
Definition: AuthManagerSpecialPage.php:398
wfAppendQuery
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Definition: GlobalFunctions.php:439
AuthManagerSpecialPage\$subPage
string $subPage
Subpage of the special page.
Definition: AuthManagerSpecialPage.php:35
LoginSignupSpecialPage\$mEntryError
$mEntryError
Definition: LoginSignupSpecialPage.php:46
DerivativeContext
An IContextSource implementation which will inherit context from another source but allow individual ...
Definition: DerivativeContext.php:30
$wgLoginLanguageSelector
$wgLoginLanguageSelector
Show a bar of language selection links in the user login and user registration forms; edit the "login...
Definition: DefaultSettings.php:3200
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
getPermissionManager
getPermissionManager()
Status\wrap
static wrap( $sv)
Succinct helper method to wrap a StatusValue.
Definition: Status.php:60
LoginSignupSpecialPage\logAuthResult
logAuthResult( $success, $status=null)
Logs to the authmanager-stats channel.
LoginSignupSpecialPage
Holds shared logic for login and account creation pages.
Definition: LoginSignupSpecialPage.php:37
SpecialPage\getFullTitle
getFullTitle()
Return the full title, including $par.
Definition: SpecialPage.php:779
LoginSignupSpecialPage\$proxyAccountCreation
bool $proxyAccountCreation
True if the user if creating an account for someone else.
Definition: LoginSignupSpecialPage.php:60
MediaWiki\Auth\AuthenticationResponse
This is a value object to hold authentication response data.
Definition: AuthenticationResponse.php:37
$wgLang
$wgLang
Definition: Setup.php:776
AuthManagerSpecialPage\loadAuth
loadAuth( $subPage, $authAction=null, $reset=false)
Load or initialize $authAction, $authRequests and $subPage.
Definition: AuthManagerSpecialPage.php:232
LoginSignupSpecialPage\$mPosted
$mPosted
Definition: LoginSignupSpecialPage.php:39
LoginSignupSpecialPage\mainLoginForm
mainLoginForm(array $requests, $msg='', $msgtype='error')
Definition: LoginSignupSpecialPage.php:517
$title
$title
Definition: testCompression.php:38
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:537
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:729
LoginSignupSpecialPage\makeLanguageSelector
makeLanguageSelector()
Produce a bar of links which allow the user to select another language during login/registration but ...
Definition: LoginSignupSpecialPage.php:1118
LoginSignupSpecialPage\hasSessionCookie
hasSessionCookie()
Check if a session cookie is present.
Definition: LoginSignupSpecialPage.php:1065
LoginSignupSpecialPage\loadRequestParameters
loadRequestParameters()
Load basic request parameters for this Special page.
Definition: LoginSignupSpecialPage.php:100
LoginSignupSpecialPage\$mFromHTTP
$mFromHTTP
Definition: LoginSignupSpecialPage.php:45
PROTO_HTTPS
const PROTO_HTTPS
Definition: Defines.php:209
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:692
LoginSignupSpecialPage\$mLoaded
$mLoaded
Definition: LoginSignupSpecialPage.php:49
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
LoginSignupSpecialPage\$mAction
$mAction
Definition: LoginSignupSpecialPage.php:40
MediaWiki\Session\SessionManager
This serves as the entry point to the MediaWiki session handling system.
Definition: SessionManager.php:50
LoginSignupSpecialPage\canBypassForm
canBypassForm(&$button_name)
Determine if the login form can be bypassed.
Definition: LoginSignupSpecialPage.php:402
LoginSignupSpecialPage\$mLanguage
$mLanguage
Definition: LoginSignupSpecialPage.php:41
LoginSignupSpecialPage\$mToken
$mToken
Definition: LoginSignupSpecialPage.php:43
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1488
LoginSignupSpecialPage\$authForm
HTMLForm $authForm
Definition: LoginSignupSpecialPage.php:65
LoginSignupSpecialPage\getPageHtml
getPageHtml( $formHtml)
Add page elements which are outside the form.
Definition: LoginSignupSpecialPage.php:588
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:451
AuthManagerSpecialPage\getDefaultAction
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
MediaWiki\Auth\AuthManager
This serves as the entry point to the authentication system.
Definition: AuthManager.php:86
AuthManagerSpecialPage\getContinueAction
getContinueAction( $action)
Gets the _CONTINUE version of an action.
Definition: AuthManagerSpecialPage.php:280
$wgEmailConfirmToEdit
$wgEmailConfirmToEdit
Should editors be required to have a validated e-mail address before being allowed to edit?
Definition: DefaultSettings.php:5376
$context
$context
Definition: load.php:43
LoginSignupSpecialPage\isSignup
isSignup()
LoginSignupSpecialPage\$reasonValidatorResult
$reasonValidatorResult
Definition: LoginSignupSpecialPage.php:52
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:915
$wgDisableCookieCheck
$wgDisableCookieCheck
By default, MediaWiki checks if the client supports cookies during the login process,...
Definition: DefaultSettings.php:6339
AuthManagerSpecialPage\isActionAllowed
isActionAllowed( $action)
Checks whether AuthManager is ready to perform the action.
Definition: AuthManagerSpecialPage.php:303
LoginSignupSpecialPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: LoginSignupSpecialPage.php:1169
LoginSignupSpecialPage\showReturnToPage
showReturnToPage( $type, $returnTo='', $returnToQuery='', $stickHTTPS=false)
Add a "return to" link or redirect to it.
Definition: LoginSignupSpecialPage.php:474
AuthManagerSpecialPage\needsSubmitButton
needsSubmitButton(array $requests)
Returns true if the form built from the given AuthenticationRequests needs a submit button.
Definition: AuthManagerSpecialPage.php:567
SpecialPage\setContext
setContext( $context)
Sets the context this SpecialPage is executed in.
Definition: SpecialPage.php:682
LoginSignupSpecialPage\getPreservedParams
getPreservedParams( $withToken=false)
Returns URL query parameters which can be used to reload the page (or leave and return) while preserv...
Definition: LoginSignupSpecialPage.php:189
AuthManagerSpecialPage\isContinued
isContinued()
Returns true if this is not the first step of the authentication.
Definition: AuthManagerSpecialPage.php:267
AuthManagerSpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: AuthManagerSpecialPage.php:64
LoginSignupSpecialPage\$mLoadedRequest
$mLoadedRequest
Definition: LoginSignupSpecialPage.php:50
AuthManagerSpecialPage\getToken
getToken()
Returns the CSRF token.
Definition: AuthManagerSpecialPage.php:625
LoginSignupSpecialPage\$mSecureLoginUrl
$mSecureLoginUrl
Definition: LoginSignupSpecialPage.php:51
LoginSignupSpecialPage\$targetUser
User $targetUser
FIXME another flag for passing data.
Definition: LoginSignupSpecialPage.php:62
LoginSignupSpecialPage\execute
execute( $subPage)
Definition: LoginSignupSpecialPage.php:213
LoginSignupSpecialPage\successfulAction
successfulAction( $direct=false, $extraMessages=null)
LoginSignupSpecialPage\$securityLevel
string $securityLevel
Definition: LoginSignupSpecialPage.php:55
LoginSignupSpecialPage\onAuthChangeFormFields
onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
Change the form descriptor that determines how a field will look in the authentication form.
Definition: LoginSignupSpecialPage.php:704
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:53
LoginHelper\getValidErrorMessages
static getValidErrorMessages()
Returns an array of all valid error messages.
Definition: LoginHelper.php:37
$wgSecureLogin
$wgSecureLogin
This is to let user authenticate using https when they come from http.
Definition: DefaultSettings.php:5226
LoginSignupSpecialPage\showExtraInformation
showExtraInformation()
Show extra information such as password recovery information, link from login to signup,...
Definition: LoginSignupSpecialPage.php:752
HTMLForm\factory
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:307
$wgInitialSessionId
$wgInitialSessionId
Definition: Setup.php:703
MediaWiki\Auth\AuthenticationRequest
This is a value object for authentication requests.
Definition: AuthenticationRequest.php:37
LoginSignupSpecialPage\getAuthForm
getAuthForm(array $requests, $action, $msg='', $msgType='error')
Generates a form from the given request.
Definition: LoginSignupSpecialPage.php:652
Skin\makeInternalOrExternalUrl
static makeInternalOrExternalUrl( $name)
If url string starts with http, consider as external URL, else internal.
Definition: Skin.php:1239
LoginSignupSpecialPage\getFieldDefinitions
getFieldDefinitions()
Create a HTMLForm descriptor for the core login fields.
Definition: LoginSignupSpecialPage.php:761
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms in a reusabl...
Definition: HTMLForm.php:131
$type
$type
Definition: testCompression.php:52