1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-08 00:56:28 +02:00

Only throttle login attempts that have wrong credentials

This commit is contained in:
Marco
2016-07-09 00:58:04 +02:00
parent 1979799480
commit a0c07b198c

View File

@@ -266,9 +266,6 @@ class Auth {
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
public function login($email, $password, $remember = false) {
$this->throttle(self::THROTTLE_ACTION_LOGIN);
$this->throttle(self::THROTTLE_ACTION_LOGIN, $email);
$email = isset($email) ? trim($email) : null;
if (empty($email)) {
throw new InvalidEmailException();
@@ -308,10 +305,16 @@ class Auth {
}
}
else {
$this->throttle(self::THROTTLE_ACTION_LOGIN);
$this->throttle(self::THROTTLE_ACTION_LOGIN, $email);
throw new InvalidPasswordException();
}
}
else {
$this->throttle(self::THROTTLE_ACTION_LOGIN);
$this->throttle(self::THROTTLE_ACTION_LOGIN, $email);
throw new InvalidEmailException();
}
}