jenkins-bot has submitted this change and it was merged.

Change subject: Revert "mediawiki.special.userlogin.signup: Remove unnecessary 
field hiding code"
......................................................................


Revert "mediawiki.special.userlogin.signup: Remove unnecessary field hiding 
code"

Whoops, we actually still have the option to bring back the old
custom HTML login forms ($wgDisableAuthManager). Too early.

This reverts commit 23e5bcb767c57d3a3f90b9fc597b87c8706a4027.

Change-Id: Ifb3ab1bf27ba2190177b65f5442dde74d20140e9
---
M resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js
1 file changed, 28 insertions(+), 0 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js 
b/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js
index 770a2f0..24f54d0 100644
--- a/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js
+++ b/resources/src/mediawiki.special/mediawiki.special.userlogin.signup.js
@@ -2,6 +2,34 @@
  * JavaScript for signup form.
  */
 ( function ( mw, $ ) {
+       // When sending password by email, hide the password input fields.
+       $( function () {
+               // Always required if checked, otherwise it depends, so we use 
the original
+               var $emailLabel = $( 'label[for="wpEmail"]' ),
+                       originalText = $emailLabel.text(),
+                       requiredText = mw.message( 'createacct-emailrequired' 
).text(),
+                       $createByMailCheckbox = $( '#wpCreateaccountMail' ),
+                       $beforePwds = $( '.mw-row-password:first' ).prev(),
+                       $pwds;
+
+               function updateForCheckbox() {
+                       var checked = $createByMailCheckbox.prop( 'checked' );
+                       if ( checked ) {
+                               $pwds = $( '.mw-row-password' ).detach();
+                               $emailLabel.text( requiredText );
+                       } else {
+                               if ( $pwds ) {
+                                       $beforePwds.after( $pwds );
+                                       $pwds = null;
+                               }
+                               $emailLabel.text( originalText );
+                       }
+               }
+
+               $createByMailCheckbox.on( 'change', updateForCheckbox );
+               updateForCheckbox();
+       } );
+
        // Check if the username is invalid or already taken
        $( function () {
                var

-- 
To view, visit https://gerrit.wikimedia.org/r/300868
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb3ab1bf27ba2190177b65f5442dde74d20140e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to