WordPress.org

Make WordPress Core

Changeset 23634


Ignore:
Timestamp:
03/07/13 06:00:16 (2 years ago)
Author:
SergeyBiryukov
Message:

When adding a new user in the admin, strip slashes from the password sent to the user by email. props hakre for initial patch. fixes #17018.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r23567 r23634  
    4545    $pass1 = $pass2 = ''; 
    4646    if ( isset( $_POST['pass1'] )) 
    47         $pass1 = $_POST['pass1']; 
     47        $pass1 = wp_unslash( $_POST['pass1'] ); 
    4848    if ( isset( $_POST['pass2'] )) 
    49         $pass2 = $_POST['pass2']; 
     49        $pass2 = wp_unslash( $_POST['pass2'] ); 
    5050 
    5151    if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { 
     
    107107    /* checking that username has been typed */ 
    108108    if ( $user->user_login == '' ) 
    109         $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' )); 
     109        $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) ); 
    110110 
    111111    /* checking the password has been typed twice */ 
    112     do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 )); 
     112    do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); 
    113113 
    114114    if ( $update ) { 
     
    151151 
    152152    // Allow plugins to return their own errors. 
    153     do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) ); 
     153    do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); 
    154154 
    155155    if ( $errors->get_error_codes() ) 
     
    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'] ) ? $pass1 : '' ); 
    163163    } 
    164164    return $user_id; 
Note: See TracChangeset for help on using the changeset viewer.