diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-22 20:25:47 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-11-09 10:56:24 +0100 |
commit | 53054b2bf6a919fd4ff9b44b6ad1986f21f488b6 (patch) | |
tree | 39cad52645ce00fbf863ff8e482d10dfcbe7f26c /application/security/BanManager.php | |
parent | e09bb93e18a333eff8e6a4156f5b58ba9c7d25cd (diff) | |
download | Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.gz Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.tar.zst Shaarli-53054b2bf6a919fd4ff9b44b6ad1986f21f488b6.zip |
Apply PHP Code Beautifier on source code for linter automatic fixes
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; |