Commit e25c1520 authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

Fix user captcha

parent d8a484f4
......@@ -55,7 +55,8 @@ class Validator
private $recaptcha;
private $recaptcha_private_key;
private $stopforumspam;
private $id_p;
function __construct($feedback=false,$id_module=0,$is_admin=true)
{
$conf = new Configuration();
......@@ -65,6 +66,7 @@ class Validator
$this->stopforumspam = $conf->Get("stopforumspam");
$this->session = new Session();
$this->return = true;
$this->id_p = 0;
$this->feedback = $feedback;
$this->is_admin = $is_admin;
$this->id_module = $id_module;
......@@ -79,6 +81,9 @@ class Validator
{
$id_language = $user['id_language'];
}
if(isset($user['id'])) {
$this->id_p = (int)$user['id'];
}
}
$this->tr = new Translator($id_language,$id_module,$is_admin);
}
......@@ -413,18 +418,16 @@ class Validator
public function Captcha($post)
{
if($this->recaptcha) {
if($this->recaptcha && $this->id_p==0) {
if($this->return) {
$this->return = false;
if(isset($post["g-recaptcha-response"]) && $this->ValidRecaptcha($post["g-recaptcha-response"])) {
$this->return = true;
} else {
echo "captcha fail";
$this->MessageSet("error","error_captcha");
}
} elseif(isset($post["g-recaptcha-response"]) && !$this->ValidRecaptcha($post["g-recaptcha-response"])) {
$this->MessageSet("error","error_captcha");
echo "captcha fail";
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment