From ff1f9e7a535acd6d87277710e2c3031e327b3d0a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 15 Jan 2015 10:30:14 -0800 Subject: [PATCH] Userlogin.php: Tweaks and corrections MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Correct nesting of the block generating "Forgot your password?" link – it would be mistakenly only generated if the user could create an account. * Use ->escaped() rather than ->parse() for 'userlogin-resetpassword-link', as it is used inside a link and allowing wikitext could lead to undesirable side-effects. * Remove unused $extraAttrs variable. * Remove pointless 'size' => '20' for some fields (they are displayed full-width using CSS). * Remove pointless .mw-ui-block class, as its styles are always used for buttons in a VForm. * Prettify code for hidden fields generation. Change-Id: If749620bf2eaf58f815cae559383e1a1c842b870 --- includes/templates/Userlogin.php | 62 +++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 69266c8de3..8bbbfa6800 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -70,12 +70,10 @@ class UserloginTemplate extends BaseTemplate { ?> data['name'], 'text', array( 'class' => 'loginText mw-ui-input', 'id' => 'wpName1', 'tabindex' => '1', - 'size' => '20', // 'required' is blacklisted for now in Html.php due to browser issues. // Keeping here in case that changes. 'required' => true, @@ -97,7 +95,6 @@ class UserloginTemplate extends BaseTemplate { 'class' => 'loginPassword mw-ui-input', 'id' => 'wpPassword1', 'tabindex' => '2', - 'size' => '20', // Set focus to this field if username is filled in. 'autofocus' => (bool)$this->data['name'], 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text() @@ -146,7 +143,7 @@ class UserloginTemplate extends BaseTemplate { 'tabindex' => '6', ); $modifiers = array( - 'mw-ui-big', 'mw-ui-block', 'mw-ui-constructive', + 'mw-ui-big', 'mw-ui-constructive', ); echo Html::submitButton( $this->getMsg( 'pt-login-button' )->text(), $attrs, $modifiers ); ?> @@ -166,33 +163,50 @@ class UserloginTemplate extends BaseTemplate { ?> data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) { + echo Html::rawElement( + 'div', + array( + 'class' => 'mw-ui-vform-field mw-form-related-link-container', + ), + Linker::link( + SpecialPage::getTitleFor( 'PasswordReset' ), + $this->getMsg( 'userlogin-resetpassword-link' )->escaped() + ) + ); + } + if ( $this->haveData( 'createOrLoginHref' ) ) { - if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) { - echo Html::openElement( 'div', - array( - 'class' => 'mw-ui-vform-field mw-form-related-link-container', - ) - ) . - Linker::link( - SpecialPage::getTitleFor( 'PasswordReset' ), - $this->getMsg( 'userlogin-resetpassword-link' )->parse() - ) . - Html::closeElement( 'div' ); - } if ( $this->data['loggedin'] ) { ?> - -- 2.20.1