diff --git a/src/wp-admin/js/user-profile.js b/src/wp-admin/js/user-profile.js
index de87bb9..4f78fbf 100644
a
|
b
|
|
13 | 13 | $weakCheckbox, |
14 | 14 | |
15 | 15 | $submitButtons, |
16 | | $submitButton; |
| 16 | $submitButton, |
| 17 | currentPass; |
17 | 18 | |
18 | 19 | function generatePassword() { |
19 | 20 | if ( typeof zxcvbn !== 'function' ) { |
20 | | setTimeout( generatePassword, 50 ); |
| 21 | setTimeout( generatePassword, 50 ); |
21 | 22 | } else { |
22 | | $pass1.val( $pass1.data( 'pw' ) ); |
23 | | $pass1.trigger( 'propertychange' ); |
24 | | $pass1Wrap.addClass( 'show-password' ); |
| 23 | $pass1.val( $pass1.data( 'pw' ) ); |
| 24 | $pass1.trigger( 'pwupdate' ); |
| 25 | $pass1Wrap.addClass( 'show-password' ); |
25 | 26 | } |
26 | 27 | } |
27 | 28 | |
28 | 29 | function bindPass1() { |
29 | 30 | var passStrength = $('#pass-strength-result')[0]; |
30 | | var currentPass = $pass1.val(); |
| 31 | |
| 32 | currentPass = $pass1.val(); |
31 | 33 | |
32 | 34 | $pass1Wrap = $pass1.parent(); |
33 | 35 | |
… |
… |
|
40 | 42 | .addClass( $pass1[0].className ) |
41 | 43 | .data( 'pw', $pass1.data( 'pw' ) ) |
42 | 44 | .val( $pass1.val() ) |
43 | | .on( 'input', function () { |
44 | | $pass1.val( $pass1Text.val() ).trigger( 'propertychange' ); |
| 45 | .on( 'input propertychange', function () { |
| 46 | if ( $pass1Text.val() === currentPass ) { |
| 47 | return; |
| 48 | } |
| 49 | $pass2.val( $pass1Text.val() ); |
| 50 | $pass1.val( $pass1Text.val() ).trigger( 'pwupdate' ); |
| 51 | currentPass = $pass1Text.val(); |
45 | 52 | } ); |
46 | 53 | |
47 | 54 | $pass1.after( $pass1Text ); |
… |
… |
|
50 | 57 | generatePassword(); |
51 | 58 | } |
52 | 59 | |
53 | | $pass1.on( 'input propertychange', function () { |
| 60 | $pass1.on( 'input propertychange pwupdate', function () { |
54 | 61 | if ( $pass1.val() === currentPass ) { |
55 | 62 | return; |
56 | 63 | } |
… |
… |
|
149 | 156 | * Fix a LastPass mismatch issue, LastPass only changes pass2. |
150 | 157 | * |
151 | 158 | * This fixes the issue by copying any changes from the hidden |
152 | | * pass2 field to the pass1 field. |
| 159 | * pass2 field to the pass1 field, then running check_pass_strength. |
153 | 160 | */ |
154 | 161 | $pass2 = $('#pass2').on( 'input propertychange', function () { |
155 | 162 | if ( $pass2.val().length > 0 ) { |
156 | 163 | $pass1.val( $pass2.val() ); |
157 | | $pass1.trigger( 'propertychange' ); |
| 164 | $pass2.val(''); |
| 165 | currentPass = ''; |
| 166 | $pass1.trigger( 'pwupdate' ); |
158 | 167 | } |
159 | 168 | } ); |
160 | 169 | |
… |
… |
|
228 | 237 | var $colorpicker, $stylesheet, user_id, current_user_id, |
229 | 238 | select = $( '#display_name' ); |
230 | 239 | |
231 | | $('#pass1').val('').on( 'input propertychange', check_pass_strength ); |
232 | | $('#pass2').val('').on( 'input propertychange', check_pass_strength ); |
| 240 | $('#pass1').val('').on( 'input propertychange pwupdate', check_pass_strength ); |
233 | 241 | $('#pass-strength-result').show(); |
234 | 242 | $('.color-palette').click( function() { |
235 | 243 | $(this).siblings('input[name="admin_color"]').prop('checked', true); |