Merge "Do not record failures for non-existent accounts"

This commit is contained in:
jenkins-bot 2017-08-23 21:59:28 +00:00 committed by Gerrit Code Review
commit deef3ee3cd

View file

@ -738,6 +738,16 @@ class LoginNotify implements LoggerAwareInterface {
*/ */
public function recordFailure( User $user ) { public function recordFailure( User $user ) {
$this->incrStats( 'fail.total' ); $this->incrStats( 'fail.total' );
if ( $user->isAnon() ) {
// Login failed because user doesn't exist
// skip this user.
$this->log->debug( "Skipping recording failure for {user} - no account",
[ 'user' => $user->getName() ]
);
return;
}
$known = $this->isKnownSystemFast( $user, $user->getRequest() ); $known = $this->isKnownSystemFast( $user, $user->getRequest() );
if ( $known === self::USER_KNOWN ) { if ( $known === self::USER_KNOWN ) {
$this->recordLoginFailureFromKnownSystem( $user ); $this->recordLoginFailureFromKnownSystem( $user );