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 <?php
if ( $this->data
['loggedin'] ) { ?
>
43 <div
class="warningbox">
44 <?php
echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data
['loggedinuser'] )->parse(); ?
>
47 <section
class="mw-form-header">
48 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
52 if ( $this->data
['message'] ) {
54 <div
class="<?php $this->text( 'messagetype' ); ?>box">
56 if ( $this->data
['messagetype'] == 'error' ) {
58 <strong
><?php
$this->msg( 'loginerror' ) ?
></strong
><br
/>
61 $this->html( 'message' );
70 $this->msg( 'userlogin-yourname' );
71 if ( $this->data
['secureLoginUrl'] ) {
72 echo Html
::element( 'a', array(
73 'href' => $this->data
['secureLoginUrl'],
74 'class' => 'mw-ui-flush-right mw-secure',
75 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
79 $extraAttrs = array();
80 // Set focus to this field if its blank.
81 if ( !$this->data
['name'] ) {
82 $extraAttrs['autofocus'] = '';
84 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
85 'class' => 'loginText',
89 // 'required' is blacklisted for now in Html.php due to browser issues.
90 // Keeping here in case that changes
92 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
97 <label
for='wpPassword1'>
99 $this->msg( 'userlogin-yourpassword' );
101 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
102 echo ' ' . Linker
::link(
103 SpecialPage
::getTitleFor( 'PasswordReset' ),
104 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
105 array( 'class' => 'mw-ui-flush-right' )
111 $extraAttrs = array();
112 // Set focus to this field if username is filled in.
113 if ( $this->data
['name'] ) {
114 $extraAttrs['autofocus'] = '';
116 echo Html
::input( 'wpPassword', null, 'password', array(
117 'class' => 'loginPassword',
118 'id' => 'wpPassword1',
121 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
126 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
128 foreach ( $this->data
['domainnames'] as $dom ) {
129 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
132 <div id
="mw-user-domain-section">
133 <label
for='wpDomain'><?php
$this->msg( 'yourdomainname' ); ?
></label
>
134 <select name
="wpDomain" value
="<?php $this->text( 'domain' ); ?>"
141 if ( $this->haveData( 'extrafields' ) ) {
142 echo $this->data
['extrafields'];
147 <?php
if ( $this->data
['canremember'] ) { ?
>
148 <label
class="mw-ui-checkbox-label">
149 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
150 <?php
if ( $this->data
['remember'] ) {
151 echo 'checked="checked"';
154 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
>
161 echo Html
::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
162 'id' => 'wpLoginAttempt',
164 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
168 <div id
="mw-userlogin-help">
169 <?php
echo $this->getMsg( 'userlogin-helplink' )->parse(); ?
>
171 <?php
if ( $this->haveData( 'createOrLoginHref' ) ) { ?
>
172 <?php
if ( $this->data
['loggedin'] ) { ?
>
173 <div id
="mw-createaccount-another">
174 <h3 id
="mw-userloginlink"><a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7" class="mw-ui-button"><?php
$this->msg( 'userlogin-createanother' ); ?
></a
></h3
>
177 <div id
="mw-createaccount-cta">
178 <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
>
182 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
183 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpLoginToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
184 <?php
if ( $this->data
['cansecurelogin'] ) {?
><input type
="hidden" name
="wpForceHttps" value
="<?php $this->text( 'stickhttps' ); ?>" /><?php
} ?
>