Fixes user tests
parent
0f6dda44b8
commit
58633313e1
|
@ -90,7 +90,6 @@ class User {
|
||||||
* @return bool True if login is successful, false otherwise.
|
* @return bool True if login is successful, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function login($username, $password) {
|
public function login($username, $password) {
|
||||||
try {
|
|
||||||
// Get user's IP address
|
// Get user's IP address
|
||||||
require_once __DIR__ . '/../helpers/logs.php';
|
require_once __DIR__ . '/../helpers/logs.php';
|
||||||
$ipAddress = getUserIP();
|
$ipAddress = getUserIP();
|
||||||
|
@ -119,9 +118,6 @@ class User {
|
||||||
// Get remaining attempts AFTER this failed attempt
|
// Get remaining attempts AFTER this failed attempt
|
||||||
$remainingAttempts = $this->rateLimiter->getRemainingAttempts($username, $ipAddress);
|
$remainingAttempts = $this->rateLimiter->getRemainingAttempts($username, $ipAddress);
|
||||||
throw new Exception("Invalid credentials. {$remainingAttempts} attempts remaining.");
|
throw new Exception("Invalid credentials. {$remainingAttempts} attempts remaining.");
|
||||||
} catch (Exception $e) {
|
|
||||||
return $e->getMessage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue