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.
Built from https://develop.svn.wordpress.org/trunk@35008


git-svn-id: http://core.svn.wordpress.org/trunk@34973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-10 13:22:26 +00:00
parent 1fe64b1c65
commit a5c1f545c4
2 changed files with 2 additions and 14 deletions

View File

@ -125,25 +125,13 @@ function edit_user( $user_id = 0 ) {
*/ */
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) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) );
elseif ( !empty($pass1) && empty($pass2) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) );
} else {
if ( empty($pass1) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password.' ), array( 'form-field' => 'pass1' ) );
elseif ( empty($pass2) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) );
}
/* Check for "\" in password */ /* Check for "\" in password */
if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) ) if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) );
/* checking the password has been typed twice the same */ /* checking the password has been typed twice the same */
if ( $pass1 != $pass2 ) if ( $pass1 != $pass2 )
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in the two password fields.' ), array( 'form-field' => 'pass1' ) ); $errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) );
if ( !empty( $pass1 ) ) if ( !empty( $pass1 ) )
$user->user_pass = $pass1; $user->user_pass = $pass1;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-35007'; $wp_version = '4.4-alpha-35008';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.