diff --git src/wp-admin/js/password-strength-meter.js src/wp-admin/js/password-strength-meter.js
index 2ac7e86..3f00d67 100644
|
|
var passwordStrength; |
18 | 18 | if (password1 != password2 && password2 && password2.length > 0) |
19 | 19 | return 5; |
20 | 20 | |
| 21 | if ( 'undefined' === typeof window.zxcvbn ) { |
| 22 | |
| 23 | // Password strength unknown. |
| 24 | return -1; |
| 25 | } |
| 26 | |
21 | 27 | var result = zxcvbn( password1, blacklist ); |
22 | 28 | return result.score; |
23 | 29 | }, |
diff --git src/wp-admin/js/user-profile.js src/wp-admin/js/user-profile.js
index 5ec77bc..7d0df5b 100644
|
|
|
42 | 42 | } |
43 | 43 | |
44 | 44 | function bindPass1() { |
45 | | var passStrength = $('#pass-strength-result')[0]; |
46 | | |
47 | 45 | currentPass = $pass1.val(); |
48 | 46 | |
49 | 47 | $pass1Wrap = $pass1.parent(); |
… |
… |
|
82 | 80 | $pass1Text.val( currentPass ); |
83 | 81 | } |
84 | 82 | $pass1.add( $pass1Text ).removeClass( 'short bad good strong' ); |
85 | | |
86 | | if ( passStrength.className ) { |
87 | | $pass1.add( $pass1Text ).addClass( passStrength.className ); |
88 | | if ( 'short' === passStrength.className || 'bad' === passStrength.className ) { |
89 | | if ( ! $weakCheckbox.prop( 'checked' ) ) { |
90 | | $submitButtons.prop( 'disabled', true ); |
91 | | } |
92 | | $weakRow.show(); |
93 | | } else { |
94 | | $submitButtons.prop( 'disabled', false ); |
95 | | $weakRow.hide(); |
96 | | } |
97 | | } |
| 83 | showOrHideWeakPasswordCheckbox(); |
98 | 84 | } ); |
99 | 85 | } |
100 | 86 | |
… |
… |
|
289 | 275 | strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass1 ); |
290 | 276 | |
291 | 277 | switch ( strength ) { |
| 278 | case -1: |
| 279 | $( '#pass-strength-result' ).addClass( 'bad' ).html( pwsL10n.unknown ); |
| 280 | break; |
292 | 281 | case 2: |
293 | 282 | $('#pass-strength-result').addClass('bad').html( pwsL10n.bad ); |
294 | 283 | break; |
… |
… |
|
306 | 295 | } |
307 | 296 | } |
308 | 297 | |
| 298 | function showOrHideWeakPasswordCheckbox() { |
| 299 | var passStrength = $('#pass-strength-result')[0]; |
| 300 | |
| 301 | if ( passStrength.className ) { |
| 302 | $pass1.add( $pass1Text ).addClass( passStrength.className ); |
| 303 | if ( 'short' === passStrength.className || 'bad' === passStrength.className ) { |
| 304 | if ( ! $weakCheckbox.prop( 'checked' ) ) { |
| 305 | $submitButtons.prop( 'disabled', true ); |
| 306 | } |
| 307 | $weakRow.show(); |
| 308 | } else { |
| 309 | $submitButtons.prop( 'disabled', false ); |
| 310 | $weakRow.hide(); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
309 | 315 | $(document).ready( function() { |
310 | 316 | var $colorpicker, $stylesheet, user_id, current_user_id, |
311 | 317 | select = $( '#display_name' ); |
diff --git src/wp-admin/user-edit.php src/wp-admin/user-edit.php
index 492617d..aa6ed7f 100644
|
|
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 src/wp-includes/script-loader.php src/wp-includes/script-loader.php
index 9fff743..3b1e8fa 100644
|
|
function wp_default_scripts( &$scripts ) { |
380 | 380 | |
381 | 381 | $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 ); |
382 | 382 | did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array( |
| 383 | 'unknown' => _x( 'Password strength unknown', 'password strength' ), |
383 | 384 | 'short' => _x( 'Very weak', 'password strength' ), |
384 | 385 | 'bad' => _x( 'Weak', 'password strength' ), |
385 | 386 | 'good' => _x( 'Medium', 'password strength' ), |
… |
… |
function wp_default_scripts( &$scripts ) { |
390 | 391 | $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); |
391 | 392 | did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array( |
392 | 393 | 'warn' => __( 'Your new password has not been saved.' ), |
| 394 | 'warnWeak' => __( 'Confirm use of weak password.' ), |
393 | 395 | 'show' => __( 'Show' ), |
394 | 396 | 'hide' => __( 'Hide' ), |
395 | 397 | 'cancel' => __( 'Cancel' ), |