From 749d5ebe558e4740286241d083798a3d5b5b8e99 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 2 Jun 2020 16:58:08 +0200 Subject: [PATCH] 10.2.dev24 modification liste noire --- core/core.php | 2 +- core/module/config/config.php | 15 ++++++--------- core/module/user/user.php | 6 ++++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/core/core.php b/core/core.php index 53436636..69f50ab5 100755 --- a/core/core.php +++ b/core/core.php @@ -39,7 +39,7 @@ class common { const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '10.2.00.dev23'; + const ZWII_VERSION = '10.2.00.dev24'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; diff --git a/core/module/config/config.php b/core/module/config/config.php index 6cd5a98d..a8fdf3a5 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -610,16 +610,14 @@ class config extends common { unlink(self::DATA_DIR . 'journal.log'); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', - 'view' => 'index', + 'redirect' => helper::baseUrl() . 'config', 'notification' => 'Journal réinitialisé avec succès', 'state' => true ]); } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', - 'view' => 'index', + 'redirect' => helper::baseUrl() . 'config', 'notification' => 'Pas de journal à effacer', 'state' => false ]); @@ -656,7 +654,8 @@ class config extends common { $d = $this->getData(['blacklist']); $data = ''; foreach ($d as $key => $item) { - $data .= strftime('%d/%m/%y',$item['time']) . ';' . strftime('%R',$item['time']) . ';' . $key . ';' . $item['ip'] . PHP_EOL; + $data .= $key . ';' . $item['ip'] . ';' . strftime('%d/%m/%y',$item['lastFail']) . ';' ; + $data .= strftime('%R',$item['lastFail']) . ';' . $item['connectFail'] . PHP_EOL; } $fileName = self::TEMP_DIR . 'blacklist.log'; file_put_contents($fileName,$data); @@ -685,16 +684,14 @@ class config extends common { unlink(self::DATA_DIR . 'blacklist.json'); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', - 'view' => 'index', + 'redirect' => helper::baseUrl() . 'config', 'notification' => 'Liste noire réinitialisée avec succès', 'state' => true ]); } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', - 'view' => 'index', + 'redirect' => helper::baseUrl() . 'config', 'notification' => 'Pas de liste à effacer', 'state' => false ]); diff --git a/core/module/user/user.php b/core/module/user/user.php index 34a83c6e..f768e04e 100755 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -333,14 +333,16 @@ class user extends common { if($this->isPost()) { $userId = $this->getInput('userLoginId', helper::FILTER_ID, true); - // le userId n'existe pas, créer une entrée dans la liste noire + // le userId n'existe pas, créer ou mettre à jour une entrée dans la liste noire if( !$this->getData(['user', $userId])) { //Stockage de l'IP $this->setData([ 'blacklist', $userId, [ - 'connectFail' => $this->getData(['blacklist',$userId,'connectFail']) ? $this->getData(['blacklist',$userId,'connectFail']) + 1 : 1 + 'connectFail' => $this->getData(['blacklist',$userId,'connectFail']) ? $this->getData(['blacklist',$userId,'connectFail']) + 1 : 1, + 'lastFail' => time(), + 'ip' => $_SERVER['REMOTE_ADDR'] ] ]); $notification = 'Identifiant ou mot de passe incorrect';