<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[33450] trunk/src: Passwords UI: clean up the new JS in `wp-admin/js/user-profile.js`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/33450">33450</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/33450","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>wonderboymusic</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-07-27 21:24:36 +0000 (Mon, 27 Jul 2015)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Passwords UI: clean up the new JS in `wp-admin/js/user-profile.js`.

Instead of wrapping `#pass1` in a `<span>` dynamically, add the `<span>` to the HTML in PHP. It currently has no styling.

Fixes <a href="https://core.trac.wordpress.org/ticket/33145">#33145</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsuserprofilejs">trunk/src/wp-admin/js/user-profile.js</a></li>
<li><a href="#trunksrcwpadminusereditphp">trunk/src/wp-admin/user-edit.php</a></li>
<li><a href="#trunksrcwpadminusernewphp">trunk/src/wp-admin/user-new.php</a></li>
<li><a href="#trunksrcwploginphp">trunk/src/wp-login.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsuserprofilejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/user-profile.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/user-profile.js     2015-07-27 19:49:14 UTC (rev 33449)
+++ trunk/src/wp-admin/js/user-profile.js       2015-07-27 21:24:36 UTC (rev 33450)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,175 +1,196 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* global ajaxurl, pwsL10n, userProfileL10n */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(function($){
-       $(function(){
-               var pw_new = $('.user-pass1-wrap'),
-                       pw_line = pw_new.find('.wp-pwd'),
-                       pw_field = $('#pass1'),
-                       pw_field2 = $('#pass2'),
-                       pw_togglebtn = pw_new.find('.wp-hide-pw'),
-                       pw_generatebtn = pw_new.find('button.wp-generate-pw'),
-                       pw_cancelbtn = pw_new.find('button.wp-cancel-pw'),
-                       pw_2 = $('.user-pass2-wrap'),
-                       parentform = pw_new.closest('form'),
-                       pw_strength = $('#pass-strength-result'),
-                       pw_submitbtn_edit = $('#submit'),
-                       pw_submitbtn_new = $( '#createusersub' ),
-                       pw_checkbox = $('.pw-checkbox'),
-                       pw_weak = $('.pw-weak'),
-                       pw_update_lock = false,
-                       // Set up a text version of the password input
-                       newField = document.createElement( 'input');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(function($) {
+       var updateLock = false,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        newField.type = 'text';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass1Row,
+               $pass1Wrap,
+               $pass1,
+               $pass1Text,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        var pwFieldText = $( newField );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass2,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( pw_field.length > 0 ) {
-                       pwFieldText
-                               .attr( {
-                                       'id':           'pass1-text',
-                                       'name':         'pass1-text',
-                                       'autocomplete': 'off'
-                               } )
-                               .addClass( pw_field[0].className )
-                               .data( 'pw', pw_field.data( 'pw' ) )
-                               .val( pw_field.val() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $weakRow,
+               $weakCheckbox,
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        pw_field
-                               .wrap( '<span class="password-input-wrapper"></span>' )
-                               .after( pwFieldText );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $submitButtons,
+               $submitButton;
+
+       function generatePassword() {
+               if ( typeof zxcvbn !== 'function' ) {
+                  setTimeout( generatePassword, 50 );
+               } else {
+                  $pass1.val( $pass1.data( 'pw' ) );
+                  $pass1.trigger( 'propertychange' );
+                  $pass1Wrap.addClass( 'show-password' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                var pwWrapper = pw_field.parent();
-               var generatePassword = window.generatePassword = function() {
-                       if ( typeof zxcvbn !== 'function' ) {
-                               setTimeout( generatePassword, 50 );
-                       } else {
-                               pw_field.val( pw_field.data( 'pw' ) );
-                               pw_field.trigger( 'propertychange' );
-                               pwWrapper.addClass( 'show-password' );
-                       }
-               };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function bindPass1() {
+               var passStrength = $('#pass-strength-result')[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_2.hide();
-               pw_line.hide();
-               pw_togglebtn.show();
-               pw_generatebtn.show();
-               if ( pw_field.data( 'reveal' ) == 1 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass1Wrap = $pass1.parent();
+
+               $pass1Text = $( '<input type="text"/>' )
+                       .attr( {
+                               'id':           'pass1-text',
+                               'name':         'pass1-text',
+                               'autocomplete': 'off'
+                       } )
+                       .addClass( $pass1[0].className )
+                       .data( 'pw', $pass1.data( 'pw' ) )
+                       .val( $pass1.val() )
+                       .on( 'input', function () {
+                               $pass1.val( $pass1Text.val() ).trigger( 'propertychange' );
+                       } );
+
+               $pass1.after( $pass1Text );
+
+               if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         generatePassword();
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                parentform.on('submit', function(){
-                       pw_update_lock = false;
-                       pw_field2.val( pw_field.val() );
-                       pwWrapper.removeClass( 'show-password' );
-               });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass1.on( 'input propertychange', function () {
+                       setTimeout( function () {
+                               $pass1Text.val( $pass1.val() );
+                               $pass1.add( $pass1Text ).removeClass( 'short bad good strong' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pwFieldText.on( 'input', function(){
-                       pw_field.val( pwFieldText.val() );
-                       pw_field.trigger( 'propertychange' );
-               } );
-
-
-               pw_field.on('input propertychange', function(){
-                       setTimeout( function(){
-                               var cssClass = pw_strength.attr('class');
-                               pwFieldText.val( pw_field.val() );
-                               pw_field.add(pwFieldText).removeClass( 'short bad good strong' );
-                               if ( 'undefined' !== typeof cssClass ) {
-                                       pw_field.add(pwFieldText).addClass( cssClass );
-                                       if ( cssClass == 'short' || cssClass == 'bad' ) {
-                                               if ( ! pw_checkbox.attr( 'checked' ) ) {
-                                                       pw_submitbtn_new.attr( 'disabled','disabled' );
-                                                       pw_submitbtn_edit.attr( 'disabled','disabled' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( passStrength.className ) {
+                                       $pass1.add( $pass1Text ).addClass( passStrength.className );
+                                       if ( 'short' === passStrength.className || 'bad' === passStrength.className ) {
+                                               if ( ! $weakCheckbox.prop( 'checked' ) ) {
+                                                       $submitButtons.prop( 'disabled', true );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                pw_weak.show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $weakRow.show();
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                pw_submitbtn_new.removeAttr( 'disabled' );
-                                               pw_submitbtn_edit.removeAttr( 'disabled' );
-                                               pw_weak.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         $submitButtons.prop( 'disabled', false );
+                                               $weakRow.hide();
</ins><span class="cx" style="display: block; padding: 0 10px">                                         }
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        }, 1 );
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_checkbox.change( function() {
-                       if ( pw_checkbox.attr( 'checked' ) ) {
-                               pw_submitbtn_new.removeAttr( 'disabled' );
-                               pw_submitbtn_edit.removeAttr( 'disabled' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function bindToggleButton() {
+               var toggleButton = $pass1Row.find('.wp-hide-pw');
+               toggleButton.show().on( 'click', function () {
+                       if ( 1 === parseInt( toggleButton.data( 'toggle' ), 10 ) ) {
+                               $pass1Wrap.addClass( 'show-password' );
+                               toggleButton
+                                       .data( 'toggle', 0 )
+                                       .attr({
+                                               'aria-label': userProfileL10n.ariaHide
+                                       })
+                                       .find( '.text' )
+                                               .text( userProfileL10n.hide )
+                                       .end()
+                                       .find( '.dashicons' )
+                                               .removeClass('dashicons-visibility')
+                                               .addClass('dashicons-hidden');
+
+                               $pass1Text.focus();
+
+                               if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {
+                                       $pass1Text[0].setSelectionRange( 0, 100 );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                pw_submitbtn_new.attr( 'disabled','disabled' );
-                               pw_submitbtn_edit.attr( 'disabled','disabled' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $pass1Wrap.removeClass( 'show-password' );
+                               toggleButton
+                                       .data( 'toggle', 1 )
+                                       .attr({
+                                               'aria-label': userProfileL10n.ariaShow
+                                       })
+                                       .find( '.text' )
+                                               .text( userProfileL10n.show )
+                                       .end()
+                                       .find( '.dashicons' )
+                                               .removeClass('dashicons-hidden')
+                                               .addClass('dashicons-visibility');
+
+                               $pass1.focus();
+
+                               if ( ! _.isUndefined( $pass1[0].setSelectionRange ) ) {
+                                       $pass1[0].setSelectionRange( 0, 100 );
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                });
+       }
+
+       function bindPasswordForm() {
+               var $passwordWrapper,
+                       $generateButton,
+                       $cancelButton;
+
+               $pass1Row = $('.user-pass1-wrap');
+               // hide this
+               $('.user-pass2-wrap').hide();
+
+               $submitButton = $( '#submit' ).on( 'click', function () {
+                       updateLock = false;
+               });
+
+               $submitButtons = $submitButton.add( ' #createusersub' );
+
+               $weakRow = $( '.pw-weak' );
+               $weakCheckbox = $weakRow.find( '.pw-checkbox' );
+               $weakCheckbox.change( function() {
+                       $submitButtons.prop( 'disabled', ! $weakCheckbox.prop( 'checked' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">                 } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $pass1 = $('#pass1');
+               if ( $pass1.length ) {
+                       bindPass1();
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Fix a LastPass mismatch issue, LastPass only changes pass2.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * This fixes the issue by copying any changes from the hidden
</span><span class="cx" style="display: block; padding: 0 10px">                 * pass2 field to the pass1 field.
</span><span class="cx" style="display: block; padding: 0 10px">                 */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_field2.on( 'input propertychange', function() {
-                       if ( pw_field2.val().length > 0 ) {
-                               pw_field.val( pw_field2.val() );
-                               pw_field.trigger( 'propertychange' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass2 = $('#pass2').on( 'input propertychange', function () {
+                       if ( $pass2.val().length > 0 ) {
+                               $pass1.val( $pass2.val() );
+                               $pass1.trigger( 'propertychange' );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                } );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_new.on( 'click', 'button.wp-generate-pw', function(){
-                       pw_update_lock = true;
-                       pw_generatebtn.hide();
-                       pw_line.show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $passwordWrapper = $pass1Row.find('.wp-pwd').hide();
+
+               bindToggleButton();
+
+               $generateButton = $pass1Row.find( 'button.wp-generate-pw' ).show();
+               $generateButton.on( 'click', function () {
+                       updateLock = true;
+
+                       $generateButton.hide();
+                       $passwordWrapper.show();
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         generatePassword();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">                         _.defer( function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                pwFieldText.focus();
-                               if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
-                                       pwFieldText[0].setSelectionRange( 0, 100 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $pass1Text.focus();
+                               if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {
+                                       $pass1Text[0].setSelectionRange( 0, 100 );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        }, 0 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_submitbtn_edit.on( 'click', function() {
-                       pw_update_lock = false;
-               });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $cancelButton = $pass1Row.find( 'button.wp-cancel-pw' );
+               $cancelButton.on( 'click', function () {
+                       updateLock = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_cancelbtn.on( 'click', function() {
-                       pw_update_lock = false;
-                       pw_generatebtn.show();
-                       pw_line.hide();
-               });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $generateButton.show();
+                       $passwordWrapper.hide();
+               } );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                pw_togglebtn.on( 'click', function() {
-                       var show = pw_togglebtn.attr( 'data-toggle' );
-                       if ( show == 1 ) {
-                               pwWrapper.addClass( 'show-password' );
-                               pw_togglebtn.attr({ 'data-toggle': 0, 'aria-label': userProfileL10n.ariaHide })
-                                       .find( '.text' ).text( userProfileL10n.hide );
-                               pw_togglebtn.find( '.dashicons' ).removeClass('dashicons-visibility').addClass('dashicons-hidden');
-                               pwFieldText.focus();
-                               if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
-                                       pwFieldText[0].setSelectionRange( 0, 100 );
-                               }
-                       } else {
-                               pwWrapper.removeClass( 'show-password' );
-                               pw_togglebtn.attr({ 'data-toggle': 1, 'aria-label': userProfileL10n.ariaShow })
-                                       .find( '.text' ).text( userProfileL10n.show );
-                               pw_togglebtn.find( '.dashicons' ).removeClass('dashicons-hidden').addClass('dashicons-visibility');
-                               pw_field.focus();
-                               if ( ! _.isUndefined( pw_field[0].setSelectionRange ) ) {
-                                       pw_field[0].setSelectionRange( 0, 100 );
-                               }
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $pass1Row.closest('form').on( 'submit', function () {
+                       updateLock = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $pass2.val( $pass1.val() );
+                       $pass1Wrap.removeClass( 'show-password' );
</ins><span class="cx" style="display: block; padding: 0 10px">                 });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                /* Warn the user if password was generated but not saved */
-               $( window ).on( 'beforeunload', function() {
-                       if ( true === pw_update_lock ) {
-                               return userProfileL10n.warn;
-                       }
-               } );
-       });
-
</del><span class="cx" style="display: block; padding: 0 10px">         function check_pass_strength() {
</span><span class="cx" style="display: block; padding: 0 10px">                var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -295,6 +316,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                });
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               bindPasswordForm();
</ins><span class="cx" style="display: block; padding: 0 10px">         });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $( '#destroy-sessions' ).on( 'click', function( e ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -315,4 +338,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        window.generatePassword = generatePassword;
+
+       /* Warn the user if password was generated but not saved */
+       $( window ).on( 'beforeunload', function () {
+               if ( true === updateLock ) {
+                       return userProfileL10n.warn;
+               }
+       } );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> })(jQuery);
</span></span></pre></div>
<a id="trunksrcwpadminusereditphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/user-edit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/user-edit.php  2015-07-27 19:49:14 UTC (rev 33449)
+++ trunk/src/wp-admin/user-edit.php    2015-07-27 21:24:36 UTC (rev 33450)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -468,7 +468,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <input class="hidden" value=" " /><!-- #24364 workaround -->
</span><span class="cx" style="display: block; padding: 0 10px">                <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Generate Password' ); ?></button>
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="wp-pwd hide-if-js">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <span class="password-input-wrapper">
+                               <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
+                       </span>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="dashicons dashicons-hidden"></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="text"><?php _e( 'Hide' ); ?></span>
</span></span></pre></div>
<a id="trunksrcwpadminusernewphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/user-new.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/user-new.php   2015-07-27 19:49:14 UTC (rev 33449)
+++ trunk/src/wp-admin/user-new.php     2015-07-27 21:24:36 UTC (rev 33450)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -402,7 +402,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
</span><span class="cx" style="display: block; padding: 0 10px">                        <div class="wp-pwd hide-if-js">
</span><span class="cx" style="display: block; padding: 0 10px">                                <?php $initial_password = wp_generate_password( 24 ); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <span class="password-input-wrapper">
+                                       <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
+                               </span>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="dashicons dashicons-hidden"></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <span class="text"><?php _e( 'Hide' ); ?></span>
</span></span></pre></div>
<a id="trunksrcwploginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-login.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-login.php    2015-07-27 19:49:14 UTC (rev 33449)
+++ trunk/src/wp-login.php      2015-07-27 21:24:36 UTC (rev 33450)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -655,7 +655,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <p class="user-pass1-wrap">
</span><span class="cx" style="display: block; padding: 0 10px">                <label for="pass1"><?php _e('New password') ?></label><br />
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="wp-pwd">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <span class="password-input-wrapper">
+                               <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" aria-describedby="pass-strength-result" />
+                       </span>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div>
</span><span class="cx" style="display: block; padding: 0 10px">                </div>
</span><span class="cx" style="display: block; padding: 0 10px">        </p>
</span></span></pre>
</div>
</div>

</body>
</html>