2 // @codingStandardsIgnoreFile
4 * Html form for user login (since 1.22 with VForm appearance).
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
25 class UserloginTemplate
extends BaseTemplate
{
28 global $wgCookieExpiration;
29 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
31 <div
class="mw-ui-container">
32 <div id
="userloginprompt"><?php
$this->msgWiki('loginprompt') ?
></div
>
33 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
34 <div id
="languagelinks">
35 <p
><?php
$this->html( 'languages' ); ?
></p
>
38 <div id
="userloginForm">
39 <form name
="userlogin" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
40 <?php
if ( $this->data
['loggedin'] ) { ?
>
41 <div
class="warningbox">
42 <?php
echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data
['loggedinuser'] )->parse(); ?
>
45 <section
class="mw-form-header">
46 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
49 <?php
if ( $this->data
['message'] ) { ?
>
50 <div
class="<?php $this->text( 'messagetype' ); ?>box">
51 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
52 <strong
><?php
$this->msg( 'loginerror' ); ?
></strong
>
55 <?php
$this->html( 'message' ); ?
>
59 <div
class="mw-ui-vform-field">
62 $this->msg( 'userlogin-yourname' );
64 if ( $this->data
['secureLoginUrl'] ) {
65 echo Html
::element( 'a', array(
66 'href' => $this->data
['secureLoginUrl'],
67 'class' => 'mw-ui-flush-right mw-secure',
68 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
73 $extraAttrs = array();
74 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
75 'class' => 'loginText mw-ui-input',
79 // 'required' is blacklisted for now in Html.php due to browser issues.
80 // Keeping here in case that changes.
82 // Set focus to this field if it's blank.
83 'autofocus' => !$this->data
['name'],
84 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
89 <div
class="mw-ui-vform-field">
90 <label
for='wpPassword1'>
92 $this->msg( 'userlogin-yourpassword' );
96 echo Html
::input( 'wpPassword', null, 'password', array(
97 'class' => 'loginPassword mw-ui-input',
98 'id' => 'wpPassword1',
101 // Set focus to this field if username is filled in.
102 'autofocus' => (bool)$this->data
['name'],
103 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
109 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
110 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
111 $select->setAttribute( 'tabindex', 3 );
112 foreach ( $this->data
['domainnames'] as $dom ) {
113 $select->addOption( $dom );
116 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
117 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
118 <?php
echo $select->getHTML(); ?
>
123 if ( $this->haveData( 'extrafields' ) ) {
124 echo $this->data
['extrafields'];
128 <div
class="mw-ui-vform-field">
129 <?php
if ( $this->data
['canremember'] ) { ?
>
130 <div
class="mw-ui-checkbox">
131 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
132 <?php
if ( $this->data
['remember'] ) {
133 echo 'checked="checked"';
135 ><label
for="wpRemember">
136 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
></label
>
141 <div
class="mw-ui-vform-field">
144 'id' => 'wpLoginAttempt',
145 'name' => 'wpLoginAttempt',
149 'mw-ui-big', 'mw-ui-block', 'mw-ui-constructive',
151 echo Html
::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
155 <div
class="mw-ui-vform-field mw-form-related-link-container" id
="mw-userlogin-help">
160 'href' => Skin
::makeInternalOrExternalUrl(
161 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
164 $this->getMsg( 'userlogin-helplink2' )->text()
169 if ( $this->haveData( 'createOrLoginHref' ) ) {
170 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
171 echo Html
::openElement( 'div',
173 'class' => 'mw-ui-vform-field mw-form-related-link-container',
177 SpecialPage
::getTitleFor( 'PasswordReset' ),
178 $this->getMsg( 'userlogin-resetpassword-link' )->parse()
180 Html
::closeElement( 'div' );
182 if ( $this->data
['loggedin'] ) { ?
>
183 <div id
="mw-createaccount-another" class="mw-form-related-link-container mw-ui-vform-field">
184 <a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7"><?php
$this->msg( 'userlogin-createanother' ); ?
></a
>
187 <div id
="mw-createaccount-cta" class="mw-form-related-link-container mw-ui-vform-field">
188 <?php
$this->msg( 'userlogin-noaccount' ); ?
><a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7" class="mw-ui-button mw-ui-progressive"><?php
$this->msg( 'userlogin-joinproject' ); ?
></a
>
192 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
193 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpLoginToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
194 <?php
if ( $this->data
['cansecurelogin'] ) {?
><input type
="hidden" name
="wpForceHttps" value
="<?php $this->text( 'stickhttps' ); ?>" /><?php
} ?
>
195 <?php
if ( $this->data
['cansecurelogin'] && $this->haveData( 'fromhttp' )) {?
><input type
="hidden" name
="wpFromhttp" value
="<?php $this->text( 'fromhttp' ); ?>" /><?php
} ?
>