Ticket #24633: 24633.7.patch
File 24633.7.patch, 8.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/admin-ajax.php
49 49 ); 50 50 51 51 $core_actions_post = array( 52 'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag','delete-link',53 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment',54 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments','replyto-comment',55 'edit-comment', 'add-menu-item', 'add-meta', 'add-user','closed-postboxes',56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax',57 ' menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink',58 'sa mple-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order',59 's ave-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',60 ' wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',61 ' query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',62 ' send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',63 'save- user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail'52 'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link', 53 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 54 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment', 55 'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'closed-postboxes', 56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 'dim-comment', 57 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 58 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 59 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 'generate_password', 60 'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail', 61 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'menu-locations-save', 62 'menu-quick-search', 'meta-box-order', 'get-permalink', 'query-attachments', 'save-attachment', 63 'save-attachment-compat', 'send-link-to-editor', 64 64 ); 65 65 66 66 // Register core Ajax calls. -
src/wp-admin/includes/ajax-actions.php
2223 2223 } 2224 2224 2225 2225 /** 2226 * Ajax handler for password generation 2227 * 2228 * @since 4.0 2229 */ 2230 function wp_ajax_generate_password() { 2231 die( wp_generate_password() ); 2232 } 2233 2234 /** 2226 2235 * Ajax handler for saving backwards compatible attachment attributes. 2227 2236 * 2228 2237 * @since 3.5.0 -
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 select = $( '#display_name' ); 35 select = $( '#display_name' ), 36 show_password = $( '#show-password' ), 37 hide_password = $( '#hide-password' ), 38 pass1 = $( '#pass1' ); 36 39 37 $('#pass1').val('').keyup( check_pass_strength ); 38 $('#pass2').val('').keyup( check_pass_strength ); 39 $('#pass-strength-result').show(); 40 /* Passwords */ 41 pass1.val('').keyup(function(e) { 42 if( ! pass1.is(':focus') || 'text' == pass1.attr('type') ) { 43 //return; 44 } 45 check_pass_strength(); 46 changed = true; 47 }); 48 49 $( '#generate-password' ).on( 'click', function() { 50 if( 'profile' == pagenow ) { 51 // User's own password 52 $(pass1).attr( 'type', 'text' ); 53 } else { 54 $(pass1).attr( 'type', 'password' ); 55 } 56 $.post( ajaxurl, { action: 'generate_password' }, function( response ) { 57 pass1.val( response ).trigger('keyup'); 58 if( 'profile' == pagenow ) { 59 // User's own password 60 hide_password.show(); 61 } else { 62 hide_password.hide(); 63 show_password.show(); 64 } 65 pass1.focus(); 66 }); 67 }); 68 show_password.on('click', function(e) { 69 show_password.hide(); 70 hide_password.show(); 71 e.preventDefault(); 72 $(pass1).attr('type', 'text'); 73 }); 74 hide_password.on('click', function(e) { 75 hide_password.hide(); 76 show_password.show(); 77 e.preventDefault(); 78 $(pass1).attr('type', 'password'); 79 }); 80 81 $( '#pass-strength-result' ).show(); 82 83 /* End Passwords */ 84 40 85 $('.color-palette').click( function() { 41 86 $(this).siblings('input[name="admin_color"]').prop('checked', true); 42 87 }); -
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> 462 <input type="password" name="pass1" id="pass1" class="regular-text" 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 <p class="description"><?php _e( 'If you would like to change the password type or generate a new one. Otherwise leave this blank.' ); ?></p> 467 <br /> 468 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 469 <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> 470 <?php if( ! IS_PROFILE_PAGE ) { ?> 471 <p class="hide-if-no-js"> 472 <label for="send_password"> 473 <input type="checkbox" name="send_password" id="send_password" /> <?php _e( 'Send this password to the user by email.' ); ?> 474 </label> 475 <br/> 476 <label for="reset_password"> 477 <input type="checkbox" name="reset_password" id="reset_password" /> <?php _e( 'Encourage the user to change their password, once logged in.' ); ?> 478 </label> 479 </p> 480 <?php } ?> 464 481 </td> 465 482 </tr> 466 483 <tr> … … 468 485 <td> 469 486 <input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" /><br /> 470 487 <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 488 </td> 475 489 </tr> 476 490 <?php endif; ?>