| 1 | Index: wp-login.php
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- wp-login.php (revision 11710)
|
|---|
| 4 | +++ wp-login.php (working copy)
|
|---|
| 5 | @@ -95,9 +95,9 @@
|
|---|
| 6 | }
|
|---|
| 7 | }
|
|---|
| 8 | if ( !empty($errors) )
|
|---|
| 9 | - echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
|
|---|
| 10 | + echo '<div id="login_error">' . apply_filters('login_errors', $errors, $wp_error) . "</div>\n";
|
|---|
| 11 | if ( !empty($messages) )
|
|---|
| 12 | - echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
|
|---|
| 13 | + echo '<p class="message">' . apply_filters('login_messages', $messages, $wp_error) . "</p>\n";
|
|---|
| 14 | }
|
|---|
| 15 | } // End of login_header()
|
|---|
| 16 |
|
|---|
| 17 | Index: wp-includes/user.php
|
|---|
| 18 | ===================================================================
|
|---|
| 19 | --- wp-includes/user.php (revision 11710)
|
|---|
| 20 | +++ wp-includes/user.php (working copy)
|
|---|
| 21 | @@ -51,8 +51,13 @@
|
|---|
| 22 | $user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
|
|---|
| 23 |
|
|---|
| 24 | if ( is_wp_error($user) ) {
|
|---|
| 25 | - if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) {
|
|---|
| 26 | - $user = new WP_Error('', '');
|
|---|
| 27 | + $error_codes = $user->get_error_codes();
|
|---|
| 28 | + // if both username and password are empty, don't bother showing those error messages
|
|---|
| 29 | + if ( in_array('empty_username', $error_codes) && in_array('empty_password', $error_codes) ) {
|
|---|
| 30 | + unset($user->errors['empty_username']);
|
|---|
| 31 | + unset($user->error_data['empty_username']);
|
|---|
| 32 | + unset($user->errors['empty_password']);
|
|---|
| 33 | + unset($user->error_data['empty_password']);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | return $user;
|
|---|
| 37 | @@ -72,7 +77,11 @@
|
|---|
| 38 | if ( is_a($user, 'WP_User') ) { return $user; }
|
|---|
| 39 |
|
|---|
| 40 | if ( empty($username) || empty($password) ) {
|
|---|
| 41 | - $error = new WP_Error();
|
|---|
| 42 | + if ( is_wp_error($user) ) {
|
|---|
| 43 | + $error = $user;
|
|---|
| 44 | + } else {
|
|---|
| 45 | + $error = new WP_Error();
|
|---|
| 46 | + }
|
|---|
| 47 |
|
|---|
| 48 | if ( empty($username) )
|
|---|
| 49 | $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
|
|---|