Merge pull request #8390 from caffeineinc/bugfix/8389-login-attempt-performance-issues

Performance issues with BasicAuth and LoginAttempts
This commit is contained in:
Loz Calver 2018-09-24 10:24:29 +02:00 committed by GitHub
commit f01473f1b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,10 @@ class LoginAttempt extends DataObject
'Member' => Member::class, // only linked if the member actually exists 'Member' => Member::class, // only linked if the member actually exists
); );
private static $indexes = array(
"EmailHashed" => true
);
private static $table_name = "LoginAttempt"; private static $table_name = "LoginAttempt";
/** /**
@ -86,7 +90,6 @@ class LoginAttempt extends DataObject
public static function getByEmail($email) public static function getByEmail($email)
{ {
return static::get()->filterAny(array( return static::get()->filterAny(array(
'Email' => $email,
'EmailHashed' => sha1($email), 'EmailHashed' => sha1($email),
)); ));
} }