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 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
33 <div id
="languagelinks">
34 <p
><?php
$this->html( 'languages' ); ?
></p
>
37 <div id
="userloginForm">
38 <form name
="userlogin" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
39 <?php
if ( $this->data
['loggedin'] ) { ?
>
40 <div
class="warningbox">
41 <?php
echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data
['loggedinuser'] )->parse(); ?
>
44 <section
class="mw-form-header">
45 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
48 <?php
if ( $this->data
['message'] ) { ?
>
49 <div
class="<?php $this->text( 'messagetype' ); ?>box">
50 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
51 <strong
><?php
$this->msg( 'loginerror' ); ?
></strong
>
54 <?php
$this->html( 'message' ); ?
>
61 $this->msg( 'userlogin-yourname' );
63 if ( $this->data
['secureLoginUrl'] ) {
64 echo Html
::element( 'a', array(
65 'href' => $this->data
['secureLoginUrl'],
66 'class' => 'mw-ui-flush-right mw-secure',
67 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
72 $extraAttrs = array();
73 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
74 'class' => 'loginText',
78 // 'required' is blacklisted for now in Html.php due to browser issues.
79 // Keeping here in case that changes.
81 // Set focus to this field if it's blank.
82 'autofocus' => !$this->data
['name'],
83 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
89 <label
for='wpPassword1'>
91 $this->msg( 'userlogin-yourpassword' );
93 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
94 echo ' ' . Linker
::link(
95 SpecialPage
::getTitleFor( 'PasswordReset' ),
96 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
97 array( 'class' => 'mw-ui-flush-right' )
103 echo Html
::input( 'wpPassword', null, 'password', array(
104 'class' => 'loginPassword',
105 'id' => 'wpPassword1',
108 // Set focus to this field if username is filled in.
109 'autofocus' => (bool)$this->data
['name'],
110 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
116 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
117 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
118 $select->setAttribute( 'tabindex', 3 );
119 foreach ( $this->data
['domainnames'] as $dom ) {
120 $select->addOption( $dom );
123 <div id
="mw-user-domain-section">
124 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
125 <?php
echo $select->getHTML(); ?
>
130 if ( $this->haveData( 'extrafields' ) ) {
131 echo $this->data
['extrafields'];
136 <?php
if ( $this->data
['canremember'] ) { ?
>
137 <label
class="mw-ui-checkbox-label">
138 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
139 <?php
if ( $this->data
['remember'] ) {
140 echo 'checked="checked"';
143 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
>
150 echo Html
::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array(
151 'id' => 'wpLoginAttempt',
153 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
157 <div id
="mw-userlogin-help">
162 'href' => Skin
::makeInternalOrExternalUrl(
163 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
166 $this->getMsg( 'userlogin-helplink2' )->text()
170 <?php
if ( $this->haveData( 'createOrLoginHref' ) ) { ?
>
171 <?php
if ( $this->data
['loggedin'] ) { ?
>
172 <div id
="mw-createaccount-another">
173 <a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7" class="mw-ui-button"><?php
$this->msg( 'userlogin-createanother' ); ?
></a
>
176 <div id
="mw-createaccount-cta">
177 <?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
>
181 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
182 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpLoginToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
183 <?php
if ( $this->data
['cansecurelogin'] ) {?
><input type
="hidden" name
="wpForceHttps" value
="<?php $this->text( 'stickhttps' ); ?>" /><?php
} ?
>