diff options
Diffstat (limited to 'application/security/BanManager.php')
-rw-r--r-- | application/security/BanManager.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/application/security/BanManager.php b/application/security/BanManager.php index 288cbde0..7077af5b 100644 --- a/application/security/BanManager.php +++ b/application/security/BanManager.php | |||
@@ -1,6 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | |||
4 | namespace Shaarli\Security; | 3 | namespace Shaarli\Security; |
5 | 4 | ||
6 | use Psr\Log\LoggerInterface; | 5 | use Psr\Log\LoggerInterface; |
@@ -47,7 +46,8 @@ class BanManager | |||
47 | * @param string $banFile Path to the file containing IP bans and failures | 46 | * @param string $banFile Path to the file containing IP bans and failures |
48 | * @param LoggerInterface $logger PSR-3 logger to save login attempts in log directory | 47 | * @param LoggerInterface $logger PSR-3 logger to save login attempts in log directory |
49 | */ | 48 | */ |
50 | public function __construct($trustedProxies, $nbAttempts, $banDuration, $banFile, LoggerInterface $logger) { | 49 | public function __construct($trustedProxies, $nbAttempts, $banDuration, $banFile, LoggerInterface $logger) |
50 | { | ||
51 | $this->trustedProxies = $trustedProxies; | 51 | $this->trustedProxies = $trustedProxies; |
52 | $this->nbAttempts = $nbAttempts; | 52 | $this->nbAttempts = $nbAttempts; |
53 | $this->banDuration = $banDuration; | 53 | $this->banDuration = $banDuration; |
@@ -80,7 +80,7 @@ class BanManager | |||
80 | 80 | ||
81 | if ($this->failures[$ip] >= $this->nbAttempts) { | 81 | if ($this->failures[$ip] >= $this->nbAttempts) { |
82 | $this->bans[$ip] = time() + $this->banDuration; | 82 | $this->bans[$ip] = time() + $this->banDuration; |
83 | $this->logger->info(format_log('IP address banned from login: '. $ip, $ip)); | 83 | $this->logger->info(format_log('IP address banned from login: ' . $ip, $ip)); |
84 | } | 84 | } |
85 | $this->writeBanFile(); | 85 | $this->writeBanFile(); |
86 | } | 86 | } |
@@ -136,7 +136,7 @@ class BanManager | |||
136 | unset($this->failures[$ip]); | 136 | unset($this->failures[$ip]); |
137 | } | 137 | } |
138 | unset($this->bans[$ip]); | 138 | unset($this->bans[$ip]); |
139 | $this->logger->info(format_log('Ban lifted for: '. $ip, $ip)); | 139 | $this->logger->info(format_log('Ban lifted for: ' . $ip, $ip)); |
140 | 140 | ||
141 | $this->writeBanFile(); | 141 | $this->writeBanFile(); |
142 | return false; | 142 | return false; |