transfert du résultat dans un champ cahcé et hashé

This commit is contained in:
Prof Langues 2020-10-01 15:50:19 +02:00
parent 0216e0c1e1
commit 175dd51a18
5 changed files with 18 additions and 4 deletions

View File

@ -53,6 +53,8 @@ class template {
$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 );
$result = $firstNumber + $secondNumber;
$result = password_hash($result, PASSWORD_BCRYPT);
// Début du wrapper
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
// Label
@ -72,7 +74,13 @@ class template {
'<input type="text" %s>',
helper::sprintAttributes($attributes)
);
// Champ résultat caché
$html .= self::hidden($attributes['id'] . 'Result', [
'value' => $result,
'before' => false
]);
// Champs cachés contenant les nombres
/*
$html .= self::hidden($attributes['id'] . 'FirstNumber', [
'value' => $firstNumber,
'before' => false
@ -81,6 +89,7 @@ class template {
'value' => $secondNumber,
'before' => false
]);
*/
// Fin du wrapper
$html .= '</div>';
// Retourne le html

View File

@ -1368,8 +1368,10 @@ th.col12 {
padding-left: 10px;
padding-right: 10px;
}
#userLoginCaptcha,
#formcaptcha {
#formcaptcha,
#blogArticlecaptcha {
width: 20%;
text-align: center;
margin: auto;

View File

@ -336,7 +336,8 @@ class user extends common {
if($this->isPost()) {
// Check la captcha
if(
$this->getInput('userLoginCaptcha', helper::FILTER_INT) !== $this->getInput('userLoginCaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('userLoginCaptchaSecondNumber', helper::FILTER_INT))
//$this->getInput('userLoginCaptcha', helper::FILTER_INT) !== $this->getInput('userLoginCaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('userLoginCaptchaSecondNumber', helper::FILTER_INT))
password_verify($this->getInput('userLoginCaptcha', helper::FILTER_INT), $this->getInput('userLoginCaptchaResult') ) === false )
{
self::$inputNotices['blogArticlecaptcha'] = 'Incorrect';
}

View File

@ -342,7 +342,8 @@ class blog extends common {
// Check la captcha
if(
$this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT))
//AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT))
AND password_verify($this->getInput('blogArticlecaptcha', helper::FILTER_INT), $this->getInput('blogArticlecaptchaResult') ) === false )
{
self::$inputNotices['blogArticlecaptcha'] = 'Incorrect';
}

View File

@ -282,7 +282,8 @@ class form extends common {
// Check la captcha
if(
$this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT))
// AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT))
AND password_verify($this->getInput('formcaptcha', helper::FILTER_INT), $this->getInput('formcaptchaResult') ) === false )
{
self::$inputNotices['formcaptcha'] = 'Incorrect';