Index: wp-admin/admin-ajax.php =================================================================== --- wp-admin/admin-ajax.php (revision 25007) +++ wp-admin/admin-ajax.php (working copy) @@ -57,6 +57,7 @@ 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', + 'generate_password', ); // Register core Ajax calls. Index: wp-admin/includes/user.php =================================================================== --- wp-admin/includes/user.php (revision 25007) +++ wp-admin/includes/user.php (working copy) @@ -157,6 +157,22 @@ if ( $update ) { $user_id = wp_update_user( $user ); + + // Encourage the user to reset their password + if( ! empty( $_POST['reset_password'] ) ) { + update_user_option( $user_id, 'default_password_nag', true, true ); + } + + // Send the new, plaintext password to the user + if( ! empty( $_POST['send_password'] ) ) { + $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); + $message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n"; + $message .= sprintf( __( 'Password: %s' ), $pass1 ) . "\r\n"; + $message .= wp_login_url() . "\r\n"; + + wp_mail( $user->user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message ); + } + } else { $user_id = wp_insert_user( $user ); wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $pass1 ) : '' ); Index: wp-admin/includes/ajax-actions.php =================================================================== --- wp-admin/includes/ajax-actions.php (revision 25007) +++ wp-admin/includes/ajax-actions.php (working copy) @@ -2123,3 +2123,7 @@ } wp_send_json_success( $return ); } + +function wp_ajax_generate_password() { + die( wp_generate_password() ); +} \ No newline at end of file Index: wp-admin/js/user-profile.js =================================================================== --- wp-admin/js/user-profile.js (revision 25007) +++ wp-admin/js/user-profile.js (working copy) @@ -35,6 +35,11 @@ $('#pass1').val('').keyup( check_pass_strength ); $('#pass2').val('').keyup( check_pass_strength ); $('#pass-strength-result').show(); + $('#generate-password').on('click', function() { + $.post( ajaxurl, { action: 'generate_password' }, function( response ) { + $('#pass1,#pass2').val( response ).trigger('keyup'); + }); + }); $('.color-palette').click( function() { $(this).siblings('input[name="admin_color"]').prop('checked', true); }); Index: wp-admin/user-edit.php =================================================================== --- wp-admin/user-edit.php (revision 25007) +++ wp-admin/user-edit.php (working copy) @@ -384,12 +384,26 @@