Fixes bugs in login ratelimiting

main
Yasen Pramatarov 2025-04-14 19:36:07 +03:00
parent 8d64bf7c6e
commit 1c2c1a76fa
3 changed files with 2 additions and 8 deletions

View File

@ -104,9 +104,6 @@ class User {
require_once __DIR__ . '/../helpers/logs.php';
$ipAddress = getUserIP();
// Record attempt
$this->rateLimiter->attempt($username, $ipAddress);
// Check rate limiting first
if (!$this->rateLimiter->isAllowed($username, $ipAddress)) {
$remainingTime = $this->rateLimiter->getDecayMinutes();

View File

@ -224,9 +224,6 @@ try {
if ($rateLimiter->tooManyAttempts($username, $user_IP)) {
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