From 7e7cf2bb94ddafb4afae33f1562821fbdbf82c33 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 7 Mar 2013 06:00:16 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@23634 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/user.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index f3ec1e5bca..f47cadf8c5 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -44,9 +44,9 @@ function edit_user( $user_id = 0 ) { $pass1 = $pass2 = ''; if ( isset( $_POST['pass1'] )) - $pass1 = $_POST['pass1']; + $pass1 = wp_unslash( $_POST['pass1'] ); if ( isset( $_POST['pass2'] )) - $pass2 = $_POST['pass2']; + $pass2 = wp_unslash( $_POST['pass2'] ); if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { $new_role = sanitize_text_field( $_POST['role'] ); @@ -106,10 +106,10 @@ function edit_user( $user_id = 0 ) { /* checking that username has been typed */ if ( $user->user_login == '' ) - $errors->add( 'user_login', __( 'ERROR: Please enter a username.' )); + $errors->add( 'user_login', __( 'ERROR: Please enter a username.' ) ); /* checking the password has been typed twice */ - do_action_ref_array( 'check_passwords', array ( $user->user_login, & $pass1, & $pass2 )); + do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); if ( $update ) { if ( empty($pass1) && !empty($pass2) ) @@ -150,7 +150,7 @@ function edit_user( $user_id = 0 ) { } // Allow plugins to return their own errors. - do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) ); + do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); if ( $errors->get_error_codes() ) return $errors; @@ -159,7 +159,7 @@ function edit_user( $user_id = 0 ) { $user_id = wp_update_user( $user ); } else { $user_id = wp_insert_user( $user ); - wp_new_user_notification( $user_id, isset($_POST['send_password']) ? $pass1 : '' ); + wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? $pass1 : '' ); } return $user_id; }