From 437bbeead5694d6736e9aec6d7f467e999846613 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 10 Oct 2015 13:21:30 +0000 Subject: [PATCH] Users: Remove redundant error message when password is only entered once. "Please enter the same password in both password fields" should cover all the scenarios. Props MikeHansenMe, jmayhak, desrosj, gounder. Fixes #33101. git-svn-id: https://develop.svn.wordpress.org/trunk@35008 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/user.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php index a0444397b3..54a66ffcbc 100644 --- a/src/wp-admin/includes/user.php +++ b/src/wp-admin/includes/user.php @@ -125,25 +125,13 @@ function edit_user( $user_id = 0 ) { */ do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); - if ( $update ) { - if ( empty($pass1) && !empty($pass2) ) - $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) ); - elseif ( !empty($pass1) && empty($pass2) ) - $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) ); - } else { - if ( empty($pass1) ) - $errors->add( 'pass', __( 'ERROR: Please enter your password.' ), array( 'form-field' => 'pass1' ) ); - elseif ( empty($pass2) ) - $errors->add( 'pass', __( 'ERROR: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) ); - } - /* Check for "\" in password */ if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) ) $errors->add( 'pass', __( 'ERROR: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); /* checking the password has been typed twice the same */ if ( $pass1 != $pass2 ) - $errors->add( 'pass', __( 'ERROR: Please enter the same password in the two password fields.' ), array( 'form-field' => 'pass1' ) ); + $errors->add( 'pass', __( 'ERROR: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); if ( !empty( $pass1 ) ) $user->user_pass = $pass1;