mirror of
https://github.com/filegator/filegator.git
synced 2025-07-31 02:40:40 +02:00
lockout bugfix and version bump
This commit is contained in:
@@ -33,14 +33,6 @@ class AuthController
|
||||
$password = $request->input('password');
|
||||
$ip = $request->getClientIp();
|
||||
|
||||
if ($auth->authenticate($username, $password)) {
|
||||
$this->logger->log("Logged in {$username} from IP ".$ip);
|
||||
|
||||
return $response->json($auth->user());
|
||||
}
|
||||
|
||||
$this->logger->log("Login failed for {$username} from IP ".$ip);
|
||||
|
||||
$lockfile = md5($ip).'.lock';
|
||||
$lockout_attempts = $config->get('lockout_attempts', 5);
|
||||
$lockout_timeout = $config->get('lockout_timeout', 15);
|
||||
@@ -55,6 +47,14 @@ class AuthController
|
||||
return $response->json('Not Allowed', 429);
|
||||
}
|
||||
|
||||
if ($auth->authenticate($username, $password)) {
|
||||
$this->logger->log("Logged in {$username} from IP ".$ip);
|
||||
|
||||
return $response->json($auth->user());
|
||||
}
|
||||
|
||||
$this->logger->log("Login failed for {$username} from IP ".$ip);
|
||||
|
||||
$tmpfs->write($lockfile, 'x', true);
|
||||
|
||||
return $response->json('Login failed, please try again', 422);
|
||||
|
Reference in New Issue
Block a user