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
23 * @deprecated Will be removed when AuthManager lands.
24 * The login form will be generated via HTMLForm.
27 class UserloginTemplate
extends BaseTemplate
{
30 global $wgCookieExpiration;
31 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
33 <div
class="mw-ui-container">
34 <div id
="userloginprompt"><?php
$this->msgWiki('loginprompt') ?
></div
>
35 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
36 <div id
="languagelinks">
37 <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 */ ?
>
51 <?php
if ( $this->data
['message'] ) { ?
>
52 <div
class="<?php $this->text( 'messagetype' ); ?>box">
53 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
54 <strong
><?php
$this->msg( 'loginerror' ); ?
></strong
>
57 <?php
$this->html( 'message' ); ?
>
61 <?php
if ( $this->data
['formheader'] ) { ?
>
62 <div
class="mw-form-formheader">
63 <?php
$this->html( 'formheader' ); /* extensions such as MobileFrontend add HTML here */ ?
>
66 <div
class="mw-ui-vform-field">
69 $this->msg( 'userlogin-yourname' );
71 if ( $this->data
['secureLoginUrl'] ) {
72 echo Html
::element( 'a', [
73 'href' => $this->data
['secureLoginUrl'],
74 'class' => 'mw-ui-flush-right mw-secure',
75 ], $this->getMsg( 'userlogin-signwithsecure' )->text() );
80 echo Html
::input( 'wpName', $this->data
['name'], 'text', [
81 'class' => 'loginText mw-ui-input',
84 // 'required' is blacklisted for now in Html.php due to browser issues.
85 // Keeping here in case that changes.
87 // Set focus to this field if it's blank.
88 'autofocus' => !$this->data
['name'],
89 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
94 <div
class="mw-ui-vform-field">
95 <label
for="wpPassword1">
97 $this->msg( 'userlogin-yourpassword' );
101 echo Html
::input( 'wpPassword', null, 'password', [
102 'class' => 'loginPassword mw-ui-input',
103 'id' => 'wpPassword1',
105 // Set focus to this field if username is filled in.
106 'autofocus' => (bool)$this->data
['name'],
107 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
113 if ( isset( $this->data
['usedomain'] ) && $this->data
['usedomain'] ) {
114 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
115 $select->setAttribute( 'tabindex', 3 );
116 foreach ( $this->data
['domainnames'] as $dom ) {
117 $select->addOption( $dom );
120 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
121 <label
for="wpDomain"><?php
$this->msg( 'yourdomainname' ); ?
></label
>
122 <?php
echo $select->getHTML(); ?
>
127 if ( $this->haveData( 'extrafields' ) ) {
128 echo $this->data
['extrafields'];
132 <div
class="mw-ui-vform-field">
133 <?php
if ( $this->data
['canremember'] ) { ?
>
134 <div
class="mw-ui-checkbox">
135 <input name
="wpRemember" type
="checkbox" value
="1" id
="wpRemember" tabindex
="4"
136 <?php
if ( $this->data
['remember'] ) {
137 echo 'checked="checked"';
139 ><label
for="wpRemember">
140 <?php
echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?
></label
>
145 <div
class="mw-ui-vform-field">
148 'id' => 'wpLoginAttempt',
149 'name' => 'wpLoginAttempt',
155 echo Html
::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers );
159 <div
class="mw-ui-vform-field mw-form-related-link-container" id
="mw-userlogin-help">
164 'href' => Skin
::makeInternalOrExternalUrl(
165 wfMessage( 'helplogin-url' )->inContentLanguage()->text()
168 $this->getMsg( 'userlogin-helplink2' )->text()
174 if ( $this->data
['useemail'] && $this->data
['canreset'] && $this->data
['resetlink'] === true ) {
175 echo Html
::rawElement(
178 'class' => 'mw-ui-vform-field mw-form-related-link-container',
181 SpecialPage
::getTitleFor( 'PasswordReset' ),
182 $this->getMsg( 'userlogin-resetpassword-link' )->escaped()
187 if ( $this->haveData( 'createOrLoginHref' ) ) {
188 if ( $this->data
['loggedin'] ) { ?
>
189 <div
class="mw-form-related-link-container mw-ui-vform-field">
190 <a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7"><?php
$this->msg( 'userlogin-createanother' ); ?
></a
>
193 <div id
="mw-createaccount-cta" class="mw-ui-vform-field">
194 <?php
$this->msg( 'userlogin-noaccount' ); ?
><a href
="<?php $this->text( 'createOrLoginHref' ); ?>" id
="mw-createaccount-join" tabindex
="7" class="mw-ui-button"><?php
$this->msg( 'userlogin-joinproject' ); ?
></a
>
202 if ( $this->haveData( 'uselang' ) ) {
203 $fields .= Html
::hidden( 'uselang', $this->data
['uselang'] );
205 if ( $this->haveData( 'token' ) ) {
206 $fields .= Html
::hidden( 'wpLoginToken', $this->data
['token'] );
208 if ( $this->data
['cansecurelogin'] ) {
209 $fields .= Html
::hidden( 'wpForceHttps', $this->data
['stickhttps'] );
211 if ( $this->data
['cansecurelogin'] && $this->haveData( 'fromhttp' ) ) {
212 $fields .= Html
::hidden( 'wpFromhttp', $this->data
['fromhttp'] );