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 <?php
if ( $this->data
['formheader'] ) { ?
>
60 <div
class="mw-form-formheader">
61 <?php
$this->html( 'formheader' ); /* extensions such as MobileFrontend add html here */ ?
>
64 <div
class="mw-ui-vform-field">
67 $this->msg( 'userlogin-yourname' );
69 if ( $this->data
['secureLoginUrl'] ) {
70 echo Html
::element( 'a', array(
71 'href' => $this->data
['secureLoginUrl'],
72 'class' => 'mw-ui-flush-right mw-secure',
73 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
78 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
79 'class' => 'loginText mw-ui-input',
82 // 'required' is blacklisted for now in Html.php due to browser issues.
83 // Keeping here in case that changes.
85 // Set focus to this field if it's blank.
86 'autofocus' => !$this->data
['name'],
87 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
92 <div
class="mw-ui-vform-field">
93 <label
for='wpPassword1'>
95 $this->msg( 'userlogin-yourpassword' );
99 echo Html
::input( 'wpPassword', null, 'password', array(
100 'class' => 'loginPassword mw-ui-input',
101 'id' => 'wpPassword1',
103 // Set focus to this field if username is filled in.
104 'autofocus' => (bool)$this->data
['name'],
105 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
111 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
112 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
113 $select->setAttribute( 'tabindex', 3 );
114 foreach ( $this->data
['domainnames'] as $dom ) {
115 $select->addOption( $dom );
118 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
119 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
120 <?php
echo $select->getHTML(); ?
>
125 if ( $this->haveData( 'extrafields' ) ) {
126 echo $this->data
['extrafields'];
130 <div
class="mw-ui-vform-field">
131 <?php
if ( $this->data
['canremember'] ) { ?
>
132 <div
class="mw-ui-checkbox">
133 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
134 <?php
if ( $this->data
['remember'] ) {
135 echo 'checked="checked"';
137 ><label
for="wpRemember">
138 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
></label
>
143 <div
class="mw-ui-vform-field">
146 'id' => 'wpLoginAttempt',
147 'name' => 'wpLoginAttempt',
151 'mw-ui-constructive',
153 echo Html
::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
157 <div
class="mw-ui-vform-field mw-form-related-link-container" id
="mw-userlogin-help">
162 'href' => Skin
::makeInternalOrExternalUrl(
163 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
166 $this->getMsg( 'userlogin-helplink2' )->text()
172 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
173 echo Html
::rawElement(
176 'class' => 'mw-ui-vform-field mw-form-related-link-container',
179 SpecialPage
::getTitleFor( 'PasswordReset' ),
180 $this->getMsg( 'userlogin-resetpassword-link' )->escaped()
185 if ( $this->haveData( 'createOrLoginHref' ) ) {
186 if ( $this->data
['loggedin'] ) { ?
>
187 <div
class="mw-form-related-link-container mw-ui-vform-field">
188 <a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7"><?php
$this->msg( 'userlogin-createanother' ); ?
></a
>
191 <div id
="mw-createaccount-cta" class="mw-form-related-link-container mw-ui-vform-field">
192 <?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
>
200 if ( $this->haveData( 'uselang' ) ) {
201 $fields .= Html
::hidden( 'uselang', $this->data
['uselang'] );
203 if ( $this->haveData( 'token' ) ) {
204 $fields .= Html
::hidden( 'wpLoginToken', $this->data
['token'] );
206 if ( $this->data
['cansecurelogin'] ) {
207 $fields .= Html
::hidden( 'wpForceHttps', $this->data
['stickhttps'] );
209 if ( $this->data
['cansecurelogin'] && $this->haveData( 'fromhttp' ) ) {
210 $fields .= Html
::hidden( 'wpFromhttp', $this->data
['fromhttp'] );