WordPress.org

Make WordPress Core

Ticket #24367: 24367.3.patch

File 24367.3.patch, 1.4 KB (added by SergeyBiryukov, 5 years ago)
  • wp-admin/includes/user.php

     
    4343                $user->user_login = sanitize_user($_POST['user_login'], true);
    4444
    4545        $pass1 = $pass2 = '';
    46         if ( isset( $_POST['pass1'] ))
    47                 $pass1 = wp_unslash( $_POST['pass1'] );
    48         if ( isset( $_POST['pass2'] ))
    49                 $pass2 = wp_unslash( $_POST['pass2'] );
     46        if ( isset( $_POST['pass1'] ) )
     47                $pass1 = $_POST['pass1'];
     48        if ( isset( $_POST['pass2'] ) )
     49                $pass2 = $_POST['pass2'];
    5050
    5151        if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
    5252                $new_role = sanitize_text_field( $_POST['role'] );
     
    124124        }
    125125
    126126        /* Check for "\" in password */
    127         if ( false !== strpos( stripslashes($pass1), "\\" ) )
     127        if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) )
    128128                $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
    129129
    130130        /* checking the password has been typed twice the same */
     
    159159                $user_id = wp_update_user( $user );
    160160        } else {
    161161                $user_id = wp_insert_user( $user );
    162                 wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? $pass1 : '' );
     162                wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $pass1 ) : '' );
    163163        }
    164164        return $user_id;
    165165}