Skip to content

Commit

Permalink
captcha faible
Browse files Browse the repository at this point in the history
  • Loading branch information
fredtempez committed Oct 19, 2020
1 parent b2ed7b4 commit c5a4e16
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/class/template.class.php
Expand Up @@ -52,7 +52,7 @@ public static function captcha($nameId, array $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');
$limit = $attributes['limit'] ? 9 : count($letters)-1 ;
$limit = $attributes['limit'] ? count($letters)-1 : 10 ;
$firstNumber = rand ( 0 , $limit );
$secondNumber = rand ( 0 , $limit );
$result = $firstNumber + $secondNumber;
Expand Down
2 changes: 1 addition & 1 deletion core/core.php
Expand Up @@ -1424,7 +1424,7 @@ private function update() {
// 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(['config', 'captchaStrong', false]);
$this->setData(['core', 'dataVersion', 10303]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/module/config/config.php
Expand Up @@ -470,6 +470,7 @@ public function index() {
'proxyType' => $this->getInput('configProxyType'),
'proxyUrl' => $this->getInput('configProxyUrl'),
'proxyPort' => $this->getInput('configProxyPort',helper::FILTER_INT),
'captchaStrong' => $this->getInput('configCaptchaStrong',helper::FILTER_BOOLEAN),
'smtp' => [
'enable' => $this->getInput('configSmtpEnable',helper::FILTER_BOOLEAN),
'host' => $this->getInput('configSmtpHost',helper::FILTER_STRING_SHORT),
Expand All @@ -485,7 +486,6 @@ public function index() {
'timeout' => $this->getInput('configConnectTimeout',helper::FILTER_INT),
'log' => $this->getInput('configConnectLog',helper::FILTER_BOOLEAN),
'captcha' => $this->getInput('configConnectCaptcha',helper::FILTER_BOOLEAN),
'captcha10' => $this->getInput('configConnectCaptcha10',helper::FILTER_BOOLEAN)
]
]
]);
Expand Down
6 changes: 3 additions & 3 deletions core/module/config/view/index/index.php
Expand Up @@ -100,9 +100,9 @@
]); ?>
</div>
<div class="col4 verticalAlignBottom">
<?php echo template::checkbox('configConnectCaptcha10', true, 'Captcha simple', [
'checked' => $this->getData(['config', 'connect','captcha10']),
'help' => 'Addition limitée aux chiffres de 0 à 9. S\'applique à tous les captchas du site.'
<?php echo template::checkbox('configCaptchaStrong', true, 'Captcha simple', [
'checked' => $this->getData(['config', 'captchaStrong']),
'help' => 'Addition de nombres de 0 à 20.'
]); ?>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions core/module/install/ressource/defaultdata.php
Expand Up @@ -16,6 +16,7 @@ class init extends common {
'legalPageId' => 'mentions-legales',
'searchPageId' => 'recherche',
'maintenance' => false,
'captchaStrong' => false,
'social' => [
'facebookId' => 'facebook',
'instagramId' => '',
Expand Down
2 changes: 1 addition & 1 deletion core/module/user/view/login/login.php
Expand Up @@ -16,7 +16,7 @@
<div class="row">
<div class="col12 textAlignCenter">
<?php echo template::captcha('userLoginCaptcha', [
'limit' => $this->getData(['config','connect','captcha10'])
'limit' => $this->getData(['config','captchaStrong'])
]); ?>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion module/blog/view/article/article.php
Expand Up @@ -80,7 +80,7 @@
<div class="row">
<div class="col12">
<?php echo template::captcha('blogArticleCaptcha', [
'limit' => $this->getData(['config','connect','captcha10'])
'limit' => $this->getData(['config','captchaStrong'])
]); ?>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion module/form/view/index/index.php
Expand Up @@ -47,7 +47,7 @@
<div class="row">
<div class="col5">
<?php echo template::captcha('formCaptcha', [
'limit' => $this->getData(['config','connect','captcha10'])
'limit' => $this->getData(['config','captchaStrong'])
]); ?>
</div>
</div>
Expand Down

0 comments on commit c5a4e16

Please sign in to comment.