From 26841c795cfbab5702061b462a536fb40456e9a6 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sun, 11 Oct 2020 19:29:33 +0200 Subject: [PATCH] captcha 10 ou 20 --- core/class/template.class.php | 8 +- core/core.php | 8 +- core/module/config/config.php | 3 +- core/module/config/view/index/index.php | 197 ++++++++++++------------ core/module/user/view/login/login.php | 4 +- module/blog/view/article/article.php | 4 +- module/form/view/index/index.php | 4 +- 7 files changed, 124 insertions(+), 104 deletions(-) diff --git a/core/class/template.class.php b/core/class/template.class.php index f7384a10..d8f8f6d8 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -46,13 +46,15 @@ class template { 'help' => '', 'id' => $nameId, 'name' => $nameId, - 'value' => '' + 'value' => '', + 'limit' => false ], $attributes); // Génère deux nombres pour le captcha $numbers = array(0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20); $letters = array('u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a'); - $firstNumber = rand ( 0 , count($letters)-1 ); - $secondNumber = rand ( 0 , count($letters)-1 ); + $limit = $attributes['limit'] ? 9 : count($letters)-1 ; + $firstNumber = rand ( 0 , $limit ); + $secondNumber = rand ( 0 , $limit ); $result = $firstNumber + $secondNumber; $result = password_hash($result, PASSWORD_BCRYPT); $firstLetter = uniqid(); diff --git a/core/core.php b/core/core.php index 0ae013a9..2b4114be 100644 --- 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.3.02'; + const ZWII_VERSION = '10.3.03'; const ZWII_UPDATE_CHANNEL = "v10"; public static $actions = []; @@ -1421,6 +1421,12 @@ class common { $this->setData(['config', 'connect','captcha', true]); $this->setData(['core', 'dataVersion', 10302]); } + // Version 10.3.03 + if ($this->getData(['core', 'dataVersion']) < 10303) { + // Activation par défaut du captcha à la connexion + $this->setData(['config', 'connect','captcha10', false]); + $this->setData(['core', 'dataVersion', 10303]); + } } } diff --git a/core/module/config/config.php b/core/module/config/config.php index 835490eb..0773a373 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -484,7 +484,8 @@ class config extends common { 'attempt' => $this->getInput('configConnectAttempt',helper::FILTER_INT), 'timeout' => $this->getInput('configConnectTimeout',helper::FILTER_INT), 'log' => $this->getInput('configConnectLog',helper::FILTER_BOOLEAN), - 'captcha' => $this->getInput('configConnectCaptcha',helper::FILTER_BOOLEAN) + 'captcha' => $this->getInput('configConnectCaptcha',helper::FILTER_BOOLEAN), + 'captcha10' => $this->getInput('configConnectCaptcha10',helper::FILTER_BOOLEAN) ] ] ]); diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 25307562..f7200795 100644 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -343,6 +343,107 @@ +
+
+
+

Sécurité de la connexion +
+ +
+

+
+
+
+ 'Connexions successives', + 'selected' => $this->getData(['config', 'connect', 'attempt']) + ]); ?> +
+
+ 'Blocage après échecs', + 'selected' => $this->getData(['config', 'connect', 'timeout']) + ]); ?> +
+
+ + helper::baseUrl() . 'config/blacklistDownload', + 'value' => 'Télécharger liste noire', + 'ico' => 'download' + ]); ?> +
+
+ 'buttonRed', + 'href' => helper::baseUrl() . 'config/blacklistReset', + 'value' => 'Réinitialiser liste', + 'ico' => 'cancel' + ]); ?> +
+
+
+
+ $this->getData(['config', 'connect','captcha']) + ]); ?> +
+
+ $this->getData(['config', 'connect','captcha10']) + ]); ?> +
+
+
+
+
+
+
+
+
+

Journalisation +
+ +
+

+
+
+
+ $this->getData(['config', 'connect', 'log']) + ]); ?> +
+
+ helper::baseUrl() . 'config/logDownload', + 'value' => 'Télécharger journal', + 'ico' => 'download' + ]); ?> +
+
+ 'buttonRed', + 'href' => helper::baseUrl() . 'config/logReset', + 'value' => 'Réinitialiser journal', + 'ico' => 'cancel' + ]); ?> +
+
+
+
+
+
@@ -452,102 +553,6 @@
-
-
-
-

Sécurité de la connexion -
- -
-

-
-
-
- 'Connexions successives', - 'selected' => $this->getData(['config', 'connect', 'attempt']) - ]); ?> -
-
- 'Blocage après échecs', - 'selected' => $this->getData(['config', 'connect', 'timeout']) - ]); ?> -
-
- - helper::baseUrl() . 'config/blacklistDownload', - 'value' => 'Télécharger liste noire', - 'ico' => 'download' - ]); ?> -
-
- 'buttonRed', - 'href' => helper::baseUrl() . 'config/blacklistReset', - 'value' => 'Réinitialiser liste', - 'ico' => 'cancel' - ]); ?> -
-
-
-
- $this->getData(['config', 'connect','captcha']) - ]); ?> -
-
-
-
-
-
-
-
-
-

Journalisation -
- -
-

-
-
-
- $this->getData(['config', 'connect', 'log']) - ]); ?> -
-
- helper::baseUrl() . 'config/logDownload', - 'value' => 'Télécharger journal', - 'ico' => 'download' - ]); ?> -
-
- 'buttonRed', - 'href' => helper::baseUrl() . 'config/logReset', - 'value' => 'Réinitialiser journal', - 'ico' => 'cancel' - ]); ?> -
-
-
-
-
-
diff --git a/core/module/user/view/login/login.php b/core/module/user/view/login/login.php index c68ad1ab..a7219ce6 100644 --- a/core/module/user/view/login/login.php +++ b/core/module/user/view/login/login.php @@ -15,7 +15,9 @@ getData(['config', 'connect','captcha'])): ?>
- + $this->getData(['config','connect','captcha10']) + ]); ?>
diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 5b573ebc..6e700bdd 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -79,7 +79,9 @@ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
- + $this->getData(['config','connect','captcha10']) + ]); ?>
diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index ebf58f15..02b082e2 100644 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -46,7 +46,9 @@ getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
- + $this->getData(['config','connect','captcha10']) + ]); ?>