Use distinct error code in wp_authenticate_username_password() when user is a spammer. props sirzooro. fixes #19445.

git-svn-id: https://develop.svn.wordpress.org/trunk@23579 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-03-01 18:01:16 +00:00
parent 12882f9848
commit 3e811c5171

View File

@ -87,18 +87,18 @@ function wp_authenticate_username_password($user, $username, $password) {
$user = get_user_by('login', $username); $user = get_user_by('login', $username);
if ( !$user ) if ( !$user )
return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), wp_lostpassword_url())); return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?' ), wp_lostpassword_url() ) );
if ( is_multisite() ) { if ( is_multisite() ) {
// Is user marked as spam? // Is user marked as spam?
if ( 1 == $user->spam) if ( 1 == $user->spam )
return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Your account has been marked as a spammer.')); return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
// Is a user's blog marked as spam? // Is a user's blog marked as spam?
if ( !is_super_admin( $user->ID ) && isset($user->primary_blog) ) { if ( !is_super_admin( $user->ID ) && isset( $user->primary_blog ) ) {
$details = get_blog_details( $user->primary_blog ); $details = get_blog_details( $user->primary_blog );
if ( is_object( $details ) && $details->spam == 1 ) if ( is_object( $details ) && $details->spam == 1 )
return new WP_Error('blog_suspended', __('Site Suspended.')); return new WP_Error( 'blog_suspended', __( 'Site Suspended.' ) );
} }
} }