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 <section
class="mw-form-header">
41 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
44 <?php
if ( $this->data
['message'] ) { ?
>
45 <div
class="<?php $this->text( 'messagetype' ); ?>box">
46 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
47 <strong
><?php
$this->msg( 'loginerror' ); ?
></strong
>
50 <?php
$this->html( 'message' ); ?
>
54 <div
class="mw-ui-vform-field">
57 $this->msg( 'userlogin-yourname' );
59 if ( $this->data
['secureLoginUrl'] ) {
60 echo Html
::element( 'a', array(
61 'href' => $this->data
['secureLoginUrl'],
62 'class' => 'mw-ui-flush-right mw-secure',
63 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
68 $extraAttrs = array();
69 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
70 'class' => 'loginText mw-ui-input',
74 // 'required' is blacklisted for now in Html.php due to browser issues.
75 // Keeping here in case that changes.
77 // Set focus to this field if it's blank.
78 'autofocus' => !$this->data
['name'],
79 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
84 <div
class="mw-ui-vform-field">
85 <label
for='wpPassword1'>
87 $this->msg( 'userlogin-yourpassword' );
89 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
90 echo ' ' . Linker
::link(
91 SpecialPage
::getTitleFor( 'PasswordReset' ),
92 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
93 array( 'class' => 'mw-ui-flush-right' )
99 echo Html
::input( 'wpPassword', null, 'password', array(
100 'class' => 'loginPassword mw-ui-input',
101 'id' => 'wpPassword1',
104 // Set focus to this field if username is filled in.
105 'autofocus' => (bool)$this->data
['name'],
106 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
112 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
113 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
114 $select->setAttribute( 'tabindex', 3 );
115 foreach ( $this->data
['domainnames'] as $dom ) {
116 $select->addOption( $dom );
119 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
120 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
121 <?php
echo $select->getHTML(); ?
>
126 if ( $this->haveData( 'extrafields' ) ) {
127 echo $this->data
['extrafields'];
131 <div
class="mw-ui-vform-field">
132 <?php
if ( $this->data
['canremember'] ) { ?
>
133 <div
class="mw-ui-checkbox">
134 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
135 <?php
if ( $this->data
['remember'] ) {
136 echo 'checked="checked"';
138 ><label
for="wpRemember">
139 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
></label
>
144 <div
class="mw-ui-vform-field">
146 echo Html
::input( 'wpLoginAttempt', $this->getMsg( 'pt-login-button' )->text(), 'submit', array(
147 'id' => 'wpLoginAttempt',
149 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
154 <div
class="mw-ui-vform-field" id
="mw-userlogin-help">
159 'href' => Skin
::makeInternalOrExternalUrl(
160 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
163 $this->getMsg( 'userlogin-helplink2' )->text()
168 <?php
if ( $this->haveData( 'createOrLoginHref' ) ) { ?
>
169 <div id
="mw-createaccount-cta">
170 <?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
>
173 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
174 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpLoginToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
175 <?php
if ( $this->data
['cansecurelogin'] ) {?
><input type
="hidden" name
="wpForceHttps" value
="<?php $this->text( 'stickhttps' ); ?>" /><?php
} ?
>