Ticket #24633: 24633.3.patch
File 24633.3.patch, 6.8 KB (added by , 11 years ago) |
---|
-
wp-admin/admin-ajax.php
58 58 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 59 59 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 60 60 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 61 'save-user-color-scheme', 61 'save-user-color-scheme', 'generate_password', 62 62 ); 63 63 64 64 // Register core Ajax calls. -
wp-admin/includes/ajax-actions.php
2260 2260 update_user_meta( get_current_user_id(), 'admin_color', $color_scheme ); 2261 2261 wp_send_json_success(); 2262 2262 } 2263 2264 function wp_ajax_generate_password() { 2265 die( wp_generate_password() ); 2266 } -
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 ) : '' ); -
wp-admin/js/user-profile.js
33 33 $(document).ready( function() { 34 34 var $colorpicker, $stylesheet, user_id, current_user_id, 35 35 select = $( '#display_name' ); 36 37 var show_password = $('#show-password'); 38 var hide_password = $('#hide-password'); 39 var pass1 = $('#pass1'); 40 var pass2 = $('#pass2'); 41 var password_repeat = $('#password-repeat'); 36 42 37 $('#pass1').val('').keyup( check_pass_strength ); 38 $('#pass2').val('').keyup( check_pass_strength ); 43 /* Passwords */ 44 pass1.val('').keyup(function(e) { 45 if( ! pass1.is(':focus') || 'text' == pass1.attr('type') ){ 46 return; 47 } 48 check_pass_strength(); 49 changed = true; 50 password_repeat.show(); 51 }); 52 pass2.val('').keyup( check_pass_strength ); 53 54 $('#generate-password').on('click', function() { 55 if( 'profile' == pagenow ) { 56 // User's own password 57 $(pass1,pass2).attr('type', 'text'); 58 } else { 59 $(pass1,pass2).attr('type', 'password'); 60 } 61 $.post( ajaxurl, { action: 'generate_password' }, function( response ) { 62 $(pass1,pass2).val( response ).trigger('keyup'); 63 if( 'profile' == pagenow ) { 64 // User's own password 65 hide_password.show(); 66 } else { 67 hide_password.hide(); 68 show_password.show(); 69 } 70 pass1.focus(); 71 }); 72 }); 73 show_password.on('click', function(e) { 74 show_password.hide(); 75 hide_password.show(); 76 e.preventDefault(); 77 $(pass1,pass2).attr('type', 'text'); 78 }); 79 hide_password.on('click', function(e) { 80 hide_password.hide(); 81 show_password.show(); 82 e.preventDefault(); 83 $(pass1,pass2).attr('type', 'password'); 84 }); 85 86 39 87 $('#pass-strength-result').show(); 88 89 /* End Passwords */ 90 40 91 $('.color-palette').click( function() { 41 92 $(this).siblings('input[name="admin_color"]').prop('checked', true); 42 93 }); -
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 /> 462 <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> 463 <input type="button" name="generate-password" id="generate-password" value="<?php _e( 'Generate Password' ); ?>" class="button hide-if-no-js" /> 464 <a href="#" id="show-password" class="hidden"><?php _e( 'Show Password' ); ?></a> 465 <a href="#" id="hide-password" class="hidden"><?php _e( 'Hide Password' ); ?></a> 466 <div id="password-repeat" class="hidden"> 467 <input name="pass2" type="password" id="pass2" size="16" value="" autocomplete="off" /> 468 <label for="pass2"><?php _e( 'Repeat New Password' ); ?></label> 469 <br /> 470 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 471 <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> 472 </div> 473 <p class="description"><?php _e( 'If you would like to change the password type or generate a new one. Otherwise leave this blank.' ); ?></p> 474 <?php if( ! IS_PROFILE_PAGE ) { ?> 475 <p class="hide-if-no-js"> 476 <label for="send_password"> 477 <input type="checkbox" name="send_password" id="send_password" /> <?php _e( 'Send this password to the user by email.' ); ?> 478 </label> 479 <br/> 480 <label for="reset_password"> 481 <input type="checkbox" name="reset_password" id="reset_password" /> <?php _e( 'Encourage the user to change their password, once logged in.' ); ?> 482 </label> 483 </p> 484 <?php } ?> 463 485 <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></span> 464 486 </td> 465 487 </tr> 466 <tr>467 <th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>468 <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>474 </td>475 </tr>476 488 <?php endif; ?> 477 489 </table> 478 490