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