Merge "Whitelist the <wbr> element."
[mediawiki.git] / includes / templates / Userlogin.php
blobb9825a6b39c32cd845528aeacb9ccafc60bc718c
1 <?php
2 /**
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
20 * @file
21 * @ingroup Templates
24 class UserloginTemplate extends BaseTemplate {
26 function execute() {
27 global $wgCookieExpiration;
28 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
30 <div class="mw-ui-container">
31 <?php
32 if ( $this->haveData( 'languages' ) ) {
34 <div id="languagelinks">
35 <p><?php $this->html( 'languages' ); ?></p>
36 </div>
37 <?php
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 */ ?>
44 </section>
45 <?php
47 if ( $this->data['message'] ) {
49 <div class="<?php $this->text( 'messagetype' ); ?>box">
50 <?php
51 if ( $this->data['messagetype'] == 'error' ) {
53 <strong><?php $this->msg( 'loginerror' ) ?></strong><br />
54 <?php
56 $this->html( 'message' );
58 </div>
59 <?php
62 <div>
63 <label for='wpName1'>
64 <?php
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() );
71 } ?>
72 </label>
73 <?php
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',
81 'id' => 'wpName1',
82 'tabindex' => '1',
83 'size' => '20',
84 // 'required' is blacklisted for now in Html.php due to browser issues.
85 // Keeping here in case that changes
86 'required',
87 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
88 ) + $extraAttrs );
90 </div>
91 <div>
92 <label for='wpPassword1'>
93 <?php
94 $this->msg( 'userlogin-yourpassword' );
96 if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
97 echo Linker::link(
98 SpecialPage::getTitleFor( 'PasswordReset' ),
99 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
100 array( 'class' => 'mw-ui-flush-right' )
104 </label>
105 <?php
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',
114 'tabindex' => '2',
115 'size' => '20',
116 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
117 ) + $extraAttrs );
119 </div>
120 <?php
121 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
122 $doms = "";
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' ); ?>"
130 tabindex="3">
131 <?php echo $doms ?>
132 </select>
133 </div>
134 <?php }
136 if ( $this->haveData( 'extrafields' ) ) {
137 echo $this->data['extrafields'];
138 } ?>
140 <div>
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"';
147 } ?>
149 <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
150 </label>
151 <?php } ?>
152 </div>
154 <?php if ( $this->data['cansecurelogin'] ) { ?>
155 <div>
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"';
160 } ?>
162 <?php $this->msg( 'securelogin-stick-https' ); ?>
163 </label>
164 </div>
165 <?php } ?>
166 <div>
167 <?php
168 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
169 'id' => 'wpLoginAttempt',
170 'tabindex' => '6',
171 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
172 ) );
174 </div>
175 <div id="mw-userlogin-help">
176 <?php echo $this->getMsg( 'userlogin-helplink' )->parse(); ?>
177 </div>
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>
181 </div>
182 <?php } ?>
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 } ?>
185 </form>
186 </div>
187 </div>
188 <?php