diff --git a/src/wp-admin/js/password-strength-meter.js b/src/wp-admin/js/password-strength-meter.js
index a075c26..ea12225 100644
|
a
|
b
|
var passwordStrength; |
| 18 | 18 | if (password1 != password2 && password2 && password2.length > 0) |
| 19 | 19 | return 5; |
| 20 | 20 | |
| | 21 | if ( 'undefined' === typeof window.zxcvbn ) { |
| | 22 | // Password strength unknown |
| | 23 | return -1; |
| | 24 | } |
| | 25 | |
| 21 | 26 | var result = zxcvbn( password1, blacklist ); |
| 22 | 27 | return result.score; |
| 23 | 28 | }, |
diff --git a/src/wp-admin/js/user-profile.js b/src/wp-admin/js/user-profile.js
index 5ec77bc..f2302d3 100644
|
a
|
b
|
|
| 30 | 30 | function generatePassword() { |
| 31 | 31 | if ( typeof zxcvbn !== 'function' ) { |
| 32 | 32 | setTimeout( generatePassword, 50 ); |
| 33 | | } else { |
| | 33 | return; |
| | 34 | } else if ( ! $pass1.val() ) { |
| | 35 | // zxcvbn loaded before user entered password. |
| 34 | 36 | $pass1.val( $pass1.data( 'pw' ) ); |
| 35 | 37 | $pass1.trigger( 'pwupdate' ).trigger( 'wp-check-valid-field' ); |
| 36 | | if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) { |
| 37 | | $pass1Wrap.addClass( 'show-password' ); |
| 38 | | } else { |
| 39 | | $toggleButton.trigger( 'click' ); |
| 40 | | } |
| 41 | 38 | } |
| | 39 | else { |
| | 40 | // zxcvbn loaded after the user entered password, check strength. |
| | 41 | check_pass_strength(); |
| | 42 | } |
| | 43 | |
| | 44 | if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) { |
| | 45 | $pass1Wrap.addClass( 'show-password' ); |
| | 46 | } else { |
| | 47 | $toggleButton.trigger( 'click' ); |
| | 48 | } |
| | 49 | |
| | 50 | // Once zxcvbn loads, passwords strength is known. |
| | 51 | $( '#pw-weak-text-label' ).html( userProfileL10n.warnWeak ); |
| 42 | 52 | } |
| 43 | 53 | |
| 44 | 54 | function bindPass1() { |
| … |
… |
|
| 289 | 299 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass1 ); |
| 290 | 300 | |
| 291 | 301 | switch ( strength ) { |
| | 302 | case -1: |
| | 303 | $( '#pass-strength-result' ).addClass( 'bad' ).html( pwsL10n.unknown ); |
| | 304 | break; |
| 292 | 305 | case 2: |
| 293 | 306 | $('#pass-strength-result').addClass('bad').html( pwsL10n.bad ); |
| 294 | 307 | break; |
diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
index 04c19fb..5dc27fd 100644
|
a
|
b
|
if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profi |
| 531 | 531 | <td> |
| 532 | 532 | <label> |
| 533 | 533 | <input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
| 534 | | <?php _e( 'Confirm use of weak password' ); ?> |
| | 534 | <span id="pw-weak-text-label"><?php _e( 'Confirm use of potentially weak password' ); ?></span> |
| 535 | 535 | </label> |
| 536 | 536 | </td> |
| 537 | 537 | </tr> |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index a97bfe1..2b2a0f8 100644
|
a
|
b
|
function wp_default_scripts( &$scripts ) { |
| 379 | 379 | |
| 380 | 380 | $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 ); |
| 381 | 381 | did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array( |
| | 382 | 'unknown' => _x( 'Password strength unknown', 'password strength' ), |
| 382 | 383 | 'short' => _x( 'Very weak', 'password strength' ), |
| 383 | 384 | 'bad' => _x( 'Weak', 'password strength' ), |
| 384 | 385 | 'good' => _x( 'Medium', 'password strength' ), |
| … |
… |
function wp_default_scripts( &$scripts ) { |
| 389 | 390 | $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); |
| 390 | 391 | did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array( |
| 391 | 392 | 'warn' => __( 'Your new password has not been saved.' ), |
| | 393 | 'warnWeak' => __( 'Confirm use of weak password.' ), |
| 392 | 394 | 'show' => __( 'Show' ), |
| 393 | 395 | 'hide' => __( 'Hide' ), |
| 394 | 396 | 'cancel' => __( 'Cancel' ), |