Page 1 of 1

Google ReCpatcha ignored

Posted: Tue Dec 24, 2019 5:48 am
by thomas.huerlimann
Hi all

We have enabled Google reCAPTCHA on OpenCart 3.0.3.2 and we have it properly configured. It is visible on the registration form here.

The problem is, the Captcha is ignored. The registration is possible regardless if the captcha was solved or not.

Can someone else reproduce it, and if yes, is this a simple bug? If yes, would this be solved soon?

Best regards
Tom

Re: Google ReCpatcha ignored

Posted: Tue Dec 24, 2019 6:37 am
by IP_CAM
Die Registrierung (bitte wieder löschen) konnte erst nach Anklicken des Feldes abgeschlossen werden.
Woher aber der doppelte Bestätigunseintrag in der -breadcrumb- Sektion stammt, ist mir auch nicht klar ...
Ernst
PS: Und in diesem Forum Teil sollten wirklich nur OC Bugs erwähnt werden, nicht individuelle Fehler. ;)
Sonst macht man hier gern die Hunde scharf ...
---
Image

Re: Google ReCpatcha ignored

Posted: Tue Dec 24, 2019 10:00 pm
by cedcommerceteam
Hi,

I have checked site link provided in forum,

I have found some issue on server side validation of form,

the value of field "g-recaptcha-response" is blank but still form get submitted and account created

you can add below code for validation in controller

if (isset($this->request->post['g-recaptcha-response']) && $this->request->post['g-recaptcha-response']) {

$recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode('Recaptcha Private Key') . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']);

$recaptcha = json_decode($recaptcha, true);

if (isset($recaptcha['success']) && !$recaptcha['success']) {
$this->error['warning'] = 'Error Message';
}
} else {
$this->error['warning'] = 'Error Message';
}