Ticket #24633: 24633.25.patch
File 24633.25.patch, 11.1 KB (added by , 10 years ago) |
---|
-
src/wp-admin/admin-ajax.php
61 61 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 62 62 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 63 63 'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail', 64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin' 64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 65 'generate_password', 65 66 ); 66 67 67 68 // Register core Ajax calls. -
src/wp-admin/css/forms.css
1004 1004 padding: 0; 1005 1005 line-height: 2; 1006 1006 } 1007 1008 .form-field #domain {1009 max-width: none;1010 }1011 1007 } 1012 1008 1013 1009 @media only screen and (max-width: 768px) { -
src/wp-admin/includes/ajax-actions.php
2951 2951 2952 2952 wp_send_json_success( $status ); 2953 2953 } 2954 2955 /** 2956 * Generates a password via ajax 2957 * 2958 * @since 4.1.0 2959 */ 2960 function wp_ajax_generate_password() { 2961 wp_die( wp_generate_password( 30 ) ); 2962 } -
src/wp-admin/js/password-strength-meter.js
72 72 73 73 // Backwards compatibility. 74 74 passwordStrength = wp.passwordStrength.meter; 75 76 /** 77 * Password generation tool. 78 * 79 * @param {sting} pass1 Selector for the first password field. 80 * @param {sting} pass2 Selector for the second password field. 81 * @param {sting} submit Selector for the generate password button. 82 * 83 */ 84 wp.passwordGenerator = { 85 86 pass1: '', 87 pass2: '', 88 submit: '', 89 results: $('#pass-strength-result'), 90 91 init: function( pass1, pass2, submit ) { 92 93 wp.passwordGenerator.pass1 = $( pass1 ); 94 wp.passwordGenerator.pass2 = $( pass2 ); 95 wp.passwordGenerator.submit = $( submit ); 96 97 wp.passwordGenerator.pass2.val('').keyup( wp.passwordGenerator.check_strength() ); 98 99 // Handle user entering password 100 wp.passwordGenerator.pass1.val('').on( 'keyup', function() { 101 wp.passwordGenerator.check_strength(); 102 // Ensure fireld type is password 103 if ( 'text' === wp.passwordGenerator.pass1.attr( 'type' ) ) { 104 wp.passwordGenerator.pass1.attr( 'type', 'password' ); 105 } 106 if ( 'text' === wp.passwordGenerator.pass2.attr( 'type' ) ) { 107 wp.passwordGenerator.pass2.attr( 'type', 'password' ); 108 } 109 }); 110 111 // Handle the Generate Password button 112 $( submit ).on('click', function() { 113 114 wp.passwordGenerator.generate(); 115 116 }); 117 118 }, 119 120 generate: function() { 121 122 // Send an ajax request to the server to get a new password 123 $.post( ajaxurl, { action: 'generate_password' }, function(response) { 124 wp.passwordGenerator.pass1.val( response ).trigger( 'keyup' ); 125 wp.passwordGenerator.pass2.val( response ); 126 wp.passwordGenerator.check_strength(); 127 wp.passwordGenerator.pass1.attr( 'type', 'text' ); 128 wp.passwordGenerator.pass2.attr( 'type', 'text' ); 129 wp.passwordGenerator.pass1.focus().select(); 130 }); 131 132 }, 133 134 check_strength: function() { 135 136 var pass1 = wp.passwordGenerator.pass1.val(), pass2 = wp.passwordGenerator.pass2.val(), strength; 137 138 wp.passwordGenerator.results.removeClass('short bad good strong'); 139 if ( ! pass1 ) { 140 wp.passwordGenerator.results.html( pwsL10n.empty ); 141 return; 142 } 143 144 strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); 145 146 switch ( strength ) { 147 case 2: 148 wp.passwordGenerator.results.addClass('bad').html( pwsL10n.bad ); 149 break; 150 case 3: 151 wp.passwordGenerator.results.addClass('good').html( pwsL10n.good ); 152 break; 153 case 4: 154 wp.passwordGenerator.results.addClass('strong').html( pwsL10n.strong ); 155 break; 156 case 5: 157 wp.passwordGenerator.results.addClass('short').html( pwsL10n.mismatch ); 158 break; 159 default: 160 wp.passwordGenerator.results.addClass('short').html( pwsL10n['short'] ); 161 } 162 163 wp.passwordGenerator.results.show(); 164 165 } 166 167 }; 168 169 wp.passwordGenerator.init( '#pass1', '#pass2', '#generate-password' ); 170 75 171 })(jQuery); 172 No newline at end of file -
src/wp-admin/js/user-profile.js
1 1 /* global ajaxurl, pwsL10n */ 2 2 (function($){ 3 3 4 function check_pass_strength() { 5 var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength; 4 $(document).ready( function() { 5 var $colorpicker, $stylesheet, user_id, current_user_id, 6 select = $( '#display_name' ); 6 7 7 $('#pass-strength-result').removeClass('short bad good strong'); 8 if ( ! pass1 ) { 9 $('#pass-strength-result').html( pwsL10n.empty ); 10 return; 11 } 8 /* Passwords */ 12 9 13 strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2);10 wp.passwordGenerator.init( '#pass1', '#pass2', '#generate-password' ); 14 11 15 switch ( strength ) { 16 case 2: 17 $('#pass-strength-result').addClass('bad').html( pwsL10n.bad ); 18 break; 19 case 3: 20 $('#pass-strength-result').addClass('good').html( pwsL10n.good ); 21 break; 22 case 4: 23 $('#pass-strength-result').addClass('strong').html( pwsL10n.strong ); 24 break; 25 case 5: 26 $('#pass-strength-result').addClass('short').html( pwsL10n.mismatch ); 27 break; 28 default: 29 $('#pass-strength-result').addClass('short').html( pwsL10n['short'] ); 30 } 31 } 12 /* End Passwords */ 32 13 33 $(document).ready( function() {34 var $colorpicker, $stylesheet, user_id, current_user_id,35 select = $( '#display_name' );36 37 $('#pass1').val('').keyup( check_pass_strength );38 $('#pass2').val('').keyup( check_pass_strength );39 $('#pass-strength-result').show();40 14 $('.color-palette').click( function() { 41 15 $(this).siblings('input[name="admin_color"]').prop('checked', true); 42 16 }); -
src/wp-admin/user-edit.php
468 468 <th><label for="pass1"><?php _e( 'New Password' ); ?></label></th> 469 469 <td> 470 470 <input class="hidden" value=" " /><!-- #24364 workaround --> 471 <input type="password" name="pass1" id="pass1" class="regular-text" size="16"value="" autocomplete="off" />472 < p class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></p>471 <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" /> 472 <input type="button" name="generate-password" id="generate-password" value="<?php _e( 'Generate Password' ); ?>" class="button hide-if-no-js" /> 473 473 </td> 474 474 </tr> 475 <tr class="user-pass2-wrap">476 <th scope="row"><labelfor="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>475 <tr id="password2" class="user-pass2-wrap"> 476 <th><label class="password-repeat" for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> 477 477 <td> 478 <input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" /> 479 <p class="description"><?php _e( 'Type your new password again.' ); ?></p> 480 <br /> 481 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 482 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> 478 <div class="password-repeat"> 479 <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" /> 480 <br /> 481 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 482 <p class="description indicator-hint"><?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).' ); ?></p> 483 </div> 484 <p class="description"><?php _e( 'If you would like to change the password type or generate a new one. Otherwise leave this blank.' ); ?></p> 485 <?php if( ! IS_PROFILE_PAGE ) { ?> 486 <p class="hide-if-no-js"> 487 <label for="send_password"> 488 <input type="checkbox" name="send_password" id="send_password" value="1" /> <?php _e( 'Send this password to the user by email.' ); ?> 489 </label> 490 <br /> 491 <label for="reset_password"> 492 <input type="checkbox" name="reset_password" id="reset_password" value="1" /> <?php _e( 'Encourage the user to change their password, once logged in.' ); ?> 493 </label> 494 </p> 495 <?php } ?> 483 496 </td> 484 497 </tr> 485 498 <?php endif; ?> -
src/wp-admin/user-new.php
390 390 <td> 391 391 <input class="hidden" value=" " /><!-- #24364 workaround --> 392 392 <input name="pass1" type="password" id="pass1" autocomplete="off" /> 393 <input type="button" name="generate-password" id="generate-password" value="<?php _e( 'Generate Password' ); ?>" class="button hide-if-no-js" /> 393 394 </td> 394 395 </tr> 395 396 <tr class="form-field form-required"> -
src/wp-includes/script-loader.php
339 339 'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js', 340 340 ) ); 341 341 342 $scripts->add( 'password- strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );343 did_action( 'init' ) && $scripts->localize( 'password- strength-meter', 'pwsL10n', array(342 $scripts->add( 'password-utilities', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 ); 343 did_action( 'init' ) && $scripts->localize( 'password-utilities', 'pwsL10n', array( 344 344 'empty' => __('Strength indicator'), 345 345 'short' => __('Very weak'), 346 346 'bad' => __('Weak'), … … 350 350 'mismatch' => __('Mismatch') 351 351 ) ); 352 352 353 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); 353 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-utilities', 'wp-util' ), false, 1 ); 354 $scripts->add( 'user-new', "/wp-admin/js/user-new$suffix.js", array( 'jquery', 'password-utilities', 'wp-util' ), false, 1 ); 354 355 $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 ); 355 356 356 357 $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );