Ticket #24633: 24633-wip.patch
File 24633-wip.patch, 6.6 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
2264 2264 update_user_option( $user_id, 'admin_color', $color_scheme, true ); 2265 2265 wp_send_json_success(); 2266 2266 } 2267 2268 function wp_ajax_generate_password() { 2269 die( wp_generate_password() ); 2270 } 2271 No newline at end of file -
wp-admin/includes/user.php
157 157 158 158 if ( $update ) { 159 159 $user_id = wp_update_user( $user ); 160 161 // Encourage the user to reset their password 162 if( ! empty( $_POST['reset_password'] ) ) { 163 update_user_option( $user_id, 'default_password_nag', true, true ); 164 } 165 166 // Send the new, plaintext password to the user 167 if( ! empty( $_POST['send_password'] ) ) { 168 $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 169 $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n"; 170 $message .= sprintf( __( 'Password: %s' ), $pass1 ) . "\r\n"; 171 $message .= wp_login_url() . "\r\n"; 172 173 wp_mail( $user->user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message ); 174 } 175 160 176 } else { 161 177 $user_id = wp_insert_user( $user ); 162 178 wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $pass1 ) : '' ); -
wp-admin/js/user-profile.js
32 32 $(document).ready( function() { 33 33 var select = $('#display_name'); 34 34 35 $('#pass1').val('').keyup( check_pass_strength ); 35 /* Passwords */ 36 37 $('#pass1').val('').keyup(function(e) { 38 39 if( ! $(this).is(':focus') || 'text' == $('#pass1').attr('type') ) 40 return; 41 42 check_pass_strength(); 43 changed = true; 44 $('#password-repeat').show(); 45 }); 46 47 $('#generate-password').on('click', function() { 48 if( 'profile' == pagenow ) { 49 // User's own password 50 $('#pass1,#pass2').attr('type', 'text'); 51 } else { 52 $('#pass1,#pass2').attr('type', 'password'); 53 } 54 $('#hide-password,#show-password,#password-repeat').hide(); 55 $.post( ajaxurl, { action: 'generate_password' }, function( response ) { 56 $('#pass1,#pass2').val( response ).trigger('keyup'); 57 if( 'profile' == pagenow ) { 58 // User's own password 59 $('#hide-password').show(); 60 } else { 61 $('#hide-password').hide(); 62 $('#show-password').show(); 63 } 64 $('#pass1').focus(); 65 }); 66 }); 67 $('#show-password').on('click', function(e) { 68 $(this).hide(); 69 $('#hide-password').show(); 70 e.preventDefault(); 71 $('#pass1,#pass2').attr('type', 'text'); 72 }); 73 $('#hide-password').on('click', function(e) { 74 $(this).hide(); 75 $('#show-password').show(); 76 e.preventDefault(); 77 $('#pass1,#pass2').attr('type', 'password'); 78 }); 79 36 80 $('#pass2').val('').keyup( check_pass_strength ); 37 81 $('#pass-strength-result').show(); 82 83 /* End Passwords */ 84 38 85 $('.color-palette').click( function() { 39 86 $(this).siblings('input[name="admin_color"]').prop('checked', true); 40 87 }); -
wp-admin/user-edit.php
378 378 <th><label for="pass1"><?php _e('New Password'); ?></label></th> 379 379 <td> 380 380 <input class="hidden" value=" " /><!-- #24364 workaround --> 381 <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <span class="description"><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?></span> 381 <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> 382 <input type="button" name="generate-password" id="generate-password" value="<?php _e( 'Generate Password' ); ?>" class="button hide-if-no-js" /> 383 <a href="#" id="show-password" class="hidden"><?php _e( 'Show Password' ); ?></a> 384 <a href="#" id="hide-password" class="hidden"><?php _e( 'Hide Password' ); ?></a> 385 <div id="password-repeat" class="hidden"> 386 <input name="pass2" type="password" id="pass2" size="16" value="" autocomplete="off" /> 387 <label for="pass2"><?php _e( 'Repeat New Password' ); ?></label> 388 <br /> 389 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 390 <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> 391 </div> 392 <p class="description"><?php _e( 'If you would like to change the password type or generate a new one. Otherwise leave this blank.' ); ?></p> 393 <?php if( ! IS_PROFILE_PAGE ) { ?> 394 <p class="hide-if-no-js"> 395 <label for="send_password"> 396 <input type="checkbox" name="send_password" id="send_password" /> <?php _e( 'Send this password to the user by email.' ); ?> 397 </label> 398 <br/> 399 <label for="reset_password"> 400 <input type="checkbox" name="reset_password" id="reset_password" /> <?php _e( 'Encourage the user to change their password, once logged in.' ); ?> 401 </label> 402 </p> 403 <?php } ?> 382 404 </td> 383 405 </tr> 384 <tr>385 <th scope="row"><label for="pass2"><?php _e('Repeat New Password'); ?></label></th>386 <td>387 <input name="pass2" type="password" id="pass2" size="16" value="" autocomplete="off" /> <span class="description" for="pass2"><?php _e("Type your new password again."); ?></span>388 <br />389 <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>390 <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>391 </td>392 </tr>393 406 <?php endif; ?> 394 407 </table> 395 408