3 * Html form for user login (since 1.22 with VForm appearance).
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 class UserloginTemplate
extends BaseTemplate
{
27 global $wgCookieExpiration;
28 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
30 <div
class="mw-ui-container">
32 if ( $this->haveData( 'languages' ) ) {
34 <div id
="languagelinks">
35 <p
><?php
$this->html( 'languages' ); ?
></p
>
40 <div id
="userloginForm">
41 <form name
="userlogin" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
42 <section
class="mw-form-header">
43 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
47 if ( $this->data
['message'] ) {
49 <div
class="<?php $this->text( 'messagetype' ); ?>box">
51 if ( $this->data
['messagetype'] == 'error' ) {
53 <strong
><?php
$this->msg( 'loginerror' ) ?
></strong
><br
/>
56 $this->html( 'message' );
65 $this->msg( 'userlogin-yourname' );
66 if ( $this->data
['secureLoginUrl'] ) {
67 echo Html
::element( 'a', array(
68 'href' => $this->data
['secureLoginUrl'],
69 'class' => 'mw-ui-flush-right mw-secure',
70 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
74 $extraAttrs = array();
75 // Set focus to this field if its blank.
76 if ( !$this->data
['name'] ) {
77 $extraAttrs['autofocus'] = '';
79 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
80 'class' => 'loginText',
84 // 'required' is blacklisted for now in Html.php due to browser issues.
85 // Keeping here in case that changes
87 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
92 <label
for='wpPassword1'>
94 $this->msg( 'userlogin-yourpassword' );
96 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
98 SpecialPage
::getTitleFor( 'PasswordReset' ),
99 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
100 array( 'class' => 'mw-ui-flush-right' )
106 $extraAttrs = array();
107 // Set focus to this field if username is filled in.
108 if ( $this->data
['name'] ) {
109 $extraAttrs['autofocus'] = '';
111 echo Html
::input( 'wpPassword', null, 'password', array(
112 'class' => 'loginPassword',
113 'id' => 'wpPassword1',
116 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
121 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
123 foreach ( $this->data
['domainnames'] as $dom ) {
124 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
127 <div id
="mw-user-domain-section">
128 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
129 <select name
="wpDomain" value
="<?php $this->text( 'domain' ); ?>"
136 if ( $this->haveData( 'extrafields' ) ) {
137 echo $this->data
['extrafields'];
142 <?php
if ( $this->data
['canremember'] ) { ?
>
143 <label
class="mw-ui-checkbox-label">
144 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
145 <?php
if ( $this->data
['remember'] ) {
146 echo 'checked="checked"';
149 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
>
154 <?php
if ( $this->data
['cansecurelogin'] ) { ?
>
156 <label
class="mw-ui-checkbox-label">
157 <input name
="wpStickHTTPS" type
="checkbox" value
="1" id
="wpStickHTTPS" tabindex
="5"
158 <?php
if ( $this->data
['stickHTTPS'] ) {
159 echo 'checked="checked"';
162 <?php
$this->msg( 'securelogin-stick-https' ); ?
>
168 echo Html
::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
169 'id' => 'wpLoginAttempt',
171 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
175 <div id
="mw-userlogin-help">
176 <?php
echo $this->getMsg( 'userlogin-helplink' )->parse(); ?
>
178 <?php
if ( $this->haveData( 'createOrLoginHref' ) ) { ?
>
179 <div id
="mw-createaccount-cta">
180 <h3 id
="mw-userloginlink"><?php
$this->msg( 'userlogin-noaccount' ); ?
><a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7" class="mw-ui-button mw-ui-constructive"><?php
$this->msg( 'userlogin-joinproject' ); ?
></a
></h3
>
183 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
184 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpLoginToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>