Ticket #24633: 24633.14.patch
File 24633.14.patch, 9.5 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' 64 'parse-media-shortcode', 'generate_password', 65 65 ); 66 66 67 67 // Register core Ajax calls. -
src/wp-admin/css/forms.css
451 451 border-color: #8dff1c; 452 452 } 453 453 454 .indicator-hint {455 padding -top: 8px;454 #password2 .indicator-hint { 455 padding: 4px 0 0 220px; 456 456 } 457 457 458 458 p.search-box { … … 651 651 border: none; 652 652 } 653 653 654 .color-option { 654 .color-option, 655 .pass1-password-visibility { 655 656 cursor: pointer; 656 657 } 657 658 659 .pass1-password-visibility { 660 line-height: 18px; 661 margin-right: 20px; 662 } 663 .pass1-password-visibility:before { 664 vertical-align: middle; 665 } 666 667 .pass1-password-visibility.show { 668 color: #666; 669 } 670 671 .pass1-password-visibility.hide { 672 color: #000; 673 } 674 675 .form-table tr#password td, 676 .form-table tr#password2 td { 677 padding: 0 10px; 678 } 679 .form-table tr#password2 th, 680 .form-table tr#password th { 681 padding: 0 10px 20px 0px; 682 } 683 658 684 /*------------------------------------------------------------------------------ 659 685 19.0 - Tools 660 686 ------------------------------------------------------------------------------*/ … … 948 974 padding: 0; 949 975 line-height: 2; 950 976 } 977 978 #password2 .indicator-hint { 979 padding-left: 0; 980 } 951 981 } 952 982 953 983 @media only screen and (max-width: 768px) { -
src/wp-admin/includes/ajax-actions.php
2706 2706 if ( ! empty( $wp_scripts ) ) { 2707 2707 $wp_scripts->done = array(); 2708 2708 } 2709 2709 2710 2710 if ( 'playlist' === $_REQUEST['type'] ) { 2711 2711 wp_underscore_playlist_templates(); 2712 2712 … … 2716 2716 } 2717 2717 2718 2718 wp_send_json_success( ob_get_clean() ); 2719 } 2720 2721 /** 2722 * Generates a password via ajax 2723 * 2724 * @since 4.0.0 2725 */ 2726 function wp_ajax_generate_password() { 2727 wp_die( wp_generate_password() ); 2719 2728 } 2729 No newline at end of file -
src/wp-admin/includes/user.php
174 174 175 175 if ( $update ) { 176 176 $user_id = wp_update_user( $user ); 177 178 // Encourage the user to reset their password 179 if( ! empty( $_POST['reset_password'] ) ) { 180 update_user_option( $user_id, 'default_password_nag', true, true ); 181 } 182 183 // Send the new, plaintext password to the user 184 if( ! empty( $_POST['send_password'] ) ) { 185 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 186 $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n"; 187 $message .= sprintf( __( 'Password: %s' ), $pass1 ) . "\r\n"; 188 $message .= wp_login_url() . "\r\n"; 189 190 wp_mail( $user->user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message ); 191 } 192 177 193 } else { 178 194 $user_id = wp_insert_user( $user ); 179 195 wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $pass1 ) : '' ); -
src/wp-admin/js/user-profile.js
32 32 33 33 $(document).ready( function() { 34 34 var $colorpicker, $stylesheet, user_id, current_user_id, 35 self = this, 35 36 select = $( '#display_name' ); 36 37 37 $('#pass1').val('').keyup( check_pass_strength ); 38 $('#pass2').val('').keyup( check_pass_strength ); 38 /* Passwords */ 39 40 /** 41 * Add a Generate Password button 42 * Add a show password icon to view password when editing own profile 43 * @since 4.0.0 44 */ 45 var visibilityIconShow = $( '.pass1-password-visibility.show' ), 46 visibilityIconHide = $( '.pass1-password-visibility.hide' ), 47 pass1 = $( '#pass1' ), 48 pass2 = $( '#pass2' ), 49 password_repeat = $( '.password-repeat' ), 50 // Show the 'Show Password' icon 51 showShowPasswordIcon = function() { 52 if( 'profile' == pagenow ) { 53 visibilityIconShow.show(); 54 visibilityIconHide.hide(); 55 } 56 }, 57 // Show the 'Hide Password' icon 58 showHidePasswordIcon = function() { 59 visibilityIconShow.hide(); 60 visibilityIconHide.show(); 61 }; 62 // Handle user entering password 63 pass1.val('').keyup(function(e) { 64 check_pass_strength(); 65 changed = true; 66 67 // If the entry field is text, make password repeat field match and show 'hide password' icon 68 if ( 'text' == pass1.attr('type') ) { 69 pass2.attr('type', 'text'); 70 showHidePasswordIcon(); 71 } else { 72 // Otherwise show 'show password' icon 73 showShowPasswordIcon(); 74 } 75 // Show the password repeat field 76 password_repeat.show(); 77 }); 78 pass2.val('').keyup( check_pass_strength ); 79 80 // Handle the Generate Password button 81 $( '#generate-password' ).on('click', function() { 82 if ( 'profile' == pagenow ) { 83 // User's own password 84 pass1.attr('type', 'text'); 85 pass2.attr('type', 'text'); 86 } else { 87 pass1.attr('type', 'password'); 88 pass2.attr('type', 'password'); 89 } 90 // Send an ajax request to the server to get a new password 91 $.post( ajaxurl, { action: 'generate_password' }, function( response ) { 92 pass1.val( response ).trigger('keyup'); 93 pass2.val( response ).trigger('keyup'); 94 showHidePasswordIcon(); 95 pass1.focus(); 96 password_repeat.hide(); 97 }); 98 }); 99 // Handle clicking on the 'show password' icon 100 visibilityIconShow.on('click', function(e) { 101 showHidePasswordIcon(); 102 e.preventDefault(); 103 pass1.attr('type', 'text'); 104 pass2.attr('type', 'text'); 105 }); 106 // Handle clicking on the 'hide password' icon 107 visibilityIconHide.on('click', function(e) { 108 showShowPasswordIcon(); 109 e.preventDefault(); 110 pass1.attr('type', 'password'); 111 pass2.attr('type', 'password'); 112 }); 113 39 114 $('#pass-strength-result').show(); 115 116 /* End Passwords */ 117 40 118 $('.color-palette').click( function() { 41 119 $(this).siblings('input[name="admin_color"]').prop('checked', true); 42 120 }); -
src/wp-admin/user-edit.php
459 459 <th><label for="pass1"><?php _e( 'New Password' ); ?></label></th> 460 460 <td> 461 461 <input class="hidden" value=" " /><!-- #24364 workaround --> 462 <input type="password" name="pass1" id="pass1" class="regular-text" size="16" value="" autocomplete="off" /><br /> 463 <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></span> 464 </td> 462 <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" /> 463 <span class="dashicons dashicons-visibility pass1-password-visibility hidden show" title="<?php _e( 'Show Password' ); ?>"></span> 464 <span class="dashicons dashicons-visibility pass1-password-visibility hidden hide" title="<?php _e( 'Hide Password' ); ?>"></span> 465 <input type="button" name="generate-password" id="generate-password" value="<?php _e( 'Generate Password' ); ?>" class="button hide-if-no-js" /> 466 </td> 465 467 </tr> 466 <tr >467 <th scope="row"><labelfor="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>468 <tr id="password2"> 469 <th><label class="password-repeat hidden" for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> 468 470 <td> 469 <input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" /><br /> 470 <span class="description" for="pass2"><?php _e( 'Type your new password again.' ); ?></span> 471 <br /> 472 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 473 <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> 471 <div class="password-repeat hidden"> 472 <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" /> 473 <br /> 474 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 475 <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> 476 </div> 477 <p class="description"><?php _e( 'If you would like to change the password type or generate a new one. Otherwise leave this blank.' ); ?></p> 478 <?php if( ! IS_PROFILE_PAGE ) { ?> 479 <p class="hide-if-no-js"> 480 <label for="send_password"> 481 <input type="checkbox" name="send_password" id="send_password" value="1" /> <?php _e( 'Send this password to the user by email.' ); ?> 482 </label> 483 <br /> 484 <label for="reset_password"> 485 <input type="checkbox" name="reset_password" id="reset_password" value="1" /> <?php _e( 'Encourage the user to change their password, once logged in.' ); ?> 486 </label> 487 </p> 488 <?php } ?> 474 489 </td> 475 490 </tr> 476 491 <?php endif; ?>