Ticket #10453: plugin-auth-fix.php.diff
File plugin-auth-fix.php.diff, 1.8 KB (added by , 15 years ago) |
---|
-
wp-login.php
95 95 } 96 96 } 97 97 if ( !empty($errors) ) 98 echo '<div id="login_error">' . apply_filters('login_errors', $errors ) . "</div>\n";98 echo '<div id="login_error">' . apply_filters('login_errors', $errors, $wp_error) . "</div>\n"; 99 99 if ( !empty($messages) ) 100 echo '<p class="message">' . apply_filters('login_messages', $messages ) . "</p>\n";100 echo '<p class="message">' . apply_filters('login_messages', $messages, $wp_error) . "</p>\n"; 101 101 } 102 102 } // End of login_header() 103 103 -
wp-includes/user.php
51 51 $user = wp_authenticate($credentials['user_login'], $credentials['user_password']); 52 52 53 53 if ( is_wp_error($user) ) { 54 if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) { 55 $user = new WP_Error('', ''); 54 $error_codes = $user->get_error_codes(); 55 // if both username and password are empty, don't bother showing those error messages 56 if ( in_array('empty_username', $error_codes) && in_array('empty_password', $error_codes) ) { 57 unset($user->errors['empty_username']); 58 unset($user->error_data['empty_username']); 59 unset($user->errors['empty_password']); 60 unset($user->error_data['empty_password']); 56 61 } 57 62 58 63 return $user; … … 72 77 if ( is_a($user, 'WP_User') ) { return $user; } 73 78 74 79 if ( empty($username) || empty($password) ) { 75 $error = new WP_Error(); 80 if ( is_wp_error($user) ) { 81 $error = $user; 82 } else { 83 $error = new WP_Error(); 84 } 76 85 77 86 if ( empty($username) ) 78 87 $error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));