Fixes bugs in login ratelimiting
parent
8d64bf7c6e
commit
1c2c1a76fa
|
@ -104,9 +104,6 @@ class User {
|
||||||
require_once __DIR__ . '/../helpers/logs.php';
|
require_once __DIR__ . '/../helpers/logs.php';
|
||||||
$ipAddress = getUserIP();
|
$ipAddress = getUserIP();
|
||||||
|
|
||||||
// Record attempt
|
|
||||||
$this->rateLimiter->attempt($username, $ipAddress);
|
|
||||||
|
|
||||||
// Check rate limiting first
|
// Check rate limiting first
|
||||||
if (!$this->rateLimiter->isAllowed($username, $ipAddress)) {
|
if (!$this->rateLimiter->isAllowed($username, $ipAddress)) {
|
||||||
$remainingTime = $this->rateLimiter->getDecayMinutes();
|
$remainingTime = $this->rateLimiter->getDecayMinutes();
|
||||||
|
|
|
@ -224,9 +224,6 @@ try {
|
||||||
if ($rateLimiter->tooManyAttempts($username, $user_IP)) {
|
if ($rateLimiter->tooManyAttempts($username, $user_IP)) {
|
||||||
throw new Exception(Feedback::get('LOGIN', 'TOO_MANY_ATTEMPTS')['message']);
|
throw new Exception(Feedback::get('LOGIN', 'TOO_MANY_ATTEMPTS')['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record this attempt before trying to login
|
|
||||||
$rateLimiter->attempt($username, $user_IP, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt login
|
// Attempt login
|
||||||
|
|
Loading…
Reference in New Issue