Compare commits
No commits in common. "76f4e0e3c8648f417e951fbb809201dcba0bc0bc" and "db6dabedecbd2fc8596434d095c939c715c5c66f" have entirely different histories.
76f4e0e3c8
...
db6dabedec
|
@ -2,7 +2,6 @@
|
|||
|
||||
class RateLimiter {
|
||||
private $db;
|
||||
private $log;
|
||||
private $maxAttempts = 5; // Maximum login attempts
|
||||
private $decayMinutes = 15; // Time window in minutes
|
||||
private $ratelimitTable = 'login_attempts';
|
||||
|
@ -10,7 +9,6 @@ class RateLimiter {
|
|||
|
||||
public function __construct($database) {
|
||||
$this->db = $database->getConnection();
|
||||
$this->log = new Log($database);
|
||||
$this->createTablesIfNotExists();
|
||||
}
|
||||
|
||||
|
@ -37,23 +35,6 @@ class RateLimiter {
|
|||
UNIQUE KEY unique_ip (ip_address)
|
||||
)";
|
||||
$this->db->exec($sql);
|
||||
|
||||
// Default IPs to whitelist (local interface and private networks IPs)
|
||||
$defaultIps = [
|
||||
['127.0.0.1', false, 'localhost IPv4'],
|
||||
['::1', false, 'localhost IPv6'],
|
||||
['10.0.0.0/8', true, 'Private network (Class A)'],
|
||||
['172.16.0.0/12', true, 'Private network (Class B)'],
|
||||
['192.168.0.0/16', true, 'Private network (Class C)']
|
||||
];
|
||||
|
||||
// Insert default whitelisted IPs if they don't exist
|
||||
$stmt = $this->db->prepare("INSERT IGNORE INTO {$this->whitelistTable}
|
||||
(ip_address, is_network, description, created_by)
|
||||
VALUES (?, ?, ?, 'system')");
|
||||
foreach ($defaultIps as $ip) {
|
||||
$stmt->execute([$ip[0], $ip[1], $ip[2]]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if IP is whitelisted
|
||||
|
|
Loading…
Reference in New Issue