diff --git a/core/class/helper.class.php b/core/class/helper.class.php index f50c8ec8..3b244970 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -682,28 +682,4 @@ class helper return $text; } - /** - * Cryptage - * @param string $key la clé d'encryptage - * @param string $payload la chaine à coder - * @return string - */ - public static function encrypt($key, $payload) - { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); - $encrypted = openssl_encrypt($payload, 'aes-256-cbc', $key, 0, $iv); - return base64_encode($encrypted . '::' . $iv); - } - - /** - * Décryptage - * @param string $key la clé d'encryptage - * @param string $garble la chaine à décoder - * @return string - */ - public static function decrypt($key, $garble) - { - list($encrypted_data, $iv) = explode('::', base64_decode($garble), 2); - return openssl_decrypt($encrypted_data, 'aes-256-cbc', $key, 0, $iv); - } } diff --git a/core/core.php b/core/core.php index e298ee14..a1a8000e 100644 --- a/core/core.php +++ b/core/core.php @@ -1146,12 +1146,10 @@ class common $mail->Host = $this->getdata(['config', 'smtp', 'host']); $mail->Port = (int) $this->getdata(['config', 'smtp', 'port']); if ($this->getData(['config', 'smtp', 'auth'])) { - $mail->SMTPAutoTLS = true; $mail->SMTPSecure = true; $mail->SMTPAuth = $this->getData(['config', 'smtp', 'auth']); $mail->Username = $this->getData(['config', 'smtp', 'username']); - $mail->Password = helper::decrypt($this->getData(['config', 'smtp', 'username']), $this->getData(['config', 'smtp', 'password'])); - $mail->SMTPSecure = $this->getData(['config', 'smtp', 'secure']); + $mail->Password = $this->getData(['config', 'smtp', 'password']); } } diff --git a/core/module/config/config.php b/core/module/config/config.php index 98e1949d..dbba2910 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -455,12 +455,12 @@ class config extends common ], 'smtp' => [ 'enable' => $this->getInput('smtpEnable', helper::FILTER_BOOLEAN), - 'host' => $this->getInput('smtpHost', helper::FILTER_STRING_SHORT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)), - 'port' => $this->getInput('smtpPort', helper::FILTER_INT, $this->getInput('smtpEnable', helper::FILTER_BOOLEAN)), + 'host' => $this->getInput('smtpHost', helper::FILTER_STRING_SHORT), + 'port' => $this->getInput('smtpPort', helper::FILTER_INT), 'auth' => $this->getInput('smtpAuth', helper::FILTER_BOOLEAN), 'secure' => $this->getInput('smtpSecure', helper::FILTER_STRING_SHORT), - 'username' => $this->getInput('smtpUsername', helper::FILTER_STRING_SHORT, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN)), - 'password' => helper::encrypt($this->getData(['config', 'smtp', 'username']), $this->getInput('smtpPassword', null, $this->getInput('smtpAuth', helper::FILTER_BOOLEAN))), + 'username' => $this->getInput('smtpUsername', helper::FILTER_STRING_SHORT), + 'password' => $this->getInput('smtpPassword', helper::FILTER_STRING_SHORT), 'from' => $this->getInput('smtpFrom', helper::FILTER_MAIL, true), ], 'seo' => [ diff --git a/module/form/form.php b/module/form/form.php index a5e019ff..615692ac 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -491,7 +491,7 @@ class form extends common $this->addOutput([ 'notification' => ($sent === true ? helper::translate('Formulaire soumis') : $sent), 'redirect' => $redirect ? helper::baseUrl() . $redirect : '', - 'state' => ($sent === true ? true : null), + 'state' => ($sent === true ? true : false), 'vendor' => [ 'flatpickr' ],