- // add pre/post text
- // header used by ConfirmEdit, CondfirmAccount, Persona, WikimediaIncubator, SemanticSignup
- // should be above the error message but HTMLForm doesn't support that
- $form->addHeaderText( $fakeTemplate->get( 'header' ) );
-
- // FIXME the old form used this for error/warning messages which does not play well with
- // HTMLForm (maybe it could with a subclass?); for now only display it for signups
- // (where the JS username validation needs it) and alway empty
- if ( $this->isSignup() ) {
- // used by the mediawiki.special.userlogin.signup.js module
- $statusAreaAttribs = [ 'id' => 'mw-createacct-status-area' ];
- // $statusAreaAttribs += $msg ? [ 'class' => "{$msgType}box" ] : [ 'style' => 'display: none;' ];
- $form->addHeaderText( Html::element( 'div', $statusAreaAttribs ) );
- }
-
- // header used by MobileFrontend
- $form->addHeaderText( $fakeTemplate->get( 'formheader' ) );
-
- // blank signup footer for site customization
- if ( $this->isSignup() && $this->showExtraInformation() ) {
- // Use signupend-https for HTTPS requests if it's not blank, signupend otherwise
- $signupendMsg = $this->msg( 'signupend' );
- $signupendHttpsMsg = $this->msg( 'signupend-https' );
- if ( !$signupendMsg->isDisabled() ) {
- $signupendText = ( $usingHTTPS && !$signupendHttpsMsg->isBlank() )
- ? $signupendHttpsMsg ->parse() : $signupendMsg->parse();
- $form->addPostText( Html::rawElement( 'div', [ 'id' => 'signupend' ], $signupendText ) );
- }
- }
-
- // warning header for non-standard workflows (e.g. security reauthentication)
- if ( !$this->isSignup() && $this->getUser()->isLoggedIn() ) {
- $reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin';
- $form->addHeaderText( Html::rawElement( 'div', [ 'class' => 'warningbox' ],
- $this->msg( $reauthMessage )->params( $this->getUser()->getName() )->parse() ) );
- }
-
- if ( !$this->isSignup() && $this->showExtraInformation() ) {
- $passwordReset = new PasswordReset( $this->getConfig(), AuthManager::singleton() );
- if ( $passwordReset->isAllowed( $this->getUser() ) ) {
- $form->addFooterText( Html::rawElement(
- 'div',
- [ 'class' => 'mw-ui-vform-field mw-form-related-link-container' ],
- Linker::link(
- SpecialPage::getTitleFor( 'PasswordReset' ),
- $this->msg( 'userlogin-resetpassword-link' )->escaped()
- )
- ) );
- }
-
- // 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' );
- $linkq = $this->getReturnToQueryStringFragment();
- // Pass any language selection on to the mode switch link
- if ( $wgLoginLanguageSelector && $this->mLanguage ) {
- $linkq .= '&uselang=' . $this->mLanguage;
- }
-
- $loggedIn = $this->getUser()->isLoggedIn();
- $createOrLoginHtml = Html::rawElement( 'div',
- [ 'id' => 'mw-createaccount' . ( !$loggedIn ? '-cta' : '' ),
- 'class' => ( $loggedIn ? 'mw-form-related-link-container' : 'mw-ui-vform-field' ) ],
- ( $loggedIn ? '' : $this->msg( 'userlogin-noaccount' )->escaped() )
- . Html::element( 'a',
- [
- 'id' => 'mw-createaccount-join' . ( $loggedIn ? '-loggedin' : '' ),
- 'href' => $linkTitle->getLocalURL( $linkq ),
- 'class' => ( $loggedIn ? '' : 'mw-ui-button' ),
- 'tabindex' => 100,
- ],
- $this->msg(
- ( $this->getUser()->isLoggedIn() ?
- 'userlogin-createanother' :
- 'userlogin-joinproject'
- ) )->escaped()
- )
- );
- $form->addFooterText( $createOrLoginHtml );
- }
- }
-