eicaptcha icon indicating copy to clipboard operation
eicaptcha copied to clipboard

recaptcha v3 doesn't validate in form added with elementor form builder of warehouse theme

Open tga21 opened this issue 2 years ago • 4 comments

Check if your issue exists

  • [X] I confirm that i've search that my issue does not already exists

Your prestashop version

1.7.8.x

Eicaptcha version

2.3.x

Do you use a specific theme ?

Last version of Warehouse theme, uses elementor builder and is developed by iqitcommerce

Describe the bug

I have installed the module eicaptcha and added to it the keys for the v3 recaptcha I created. It works perfect with newsletter block in the footer but it doesn't work with the contact form that I added to the home page using elementor. Maybe i need to add something to the template but I can't figure out what it may be. I have googled about this and didn't find any clue.

Also there is no log in "/modules/eicaptcha/src/logs/debug.log"

Could you please lend me a helping hand?

Thanks for your time and attention :)

Screenshots

Captura de pantalla 2022-05-17 a las 18 15 00 Captura de pantalla 2022-05-17 a las 19 04 39

Additional context

No response

tga21 avatar May 17 '22 17:05 tga21

Hello @tga21 ,

This issue is the same as #219 and #216 In fact the captcha only works in the default contact page. I'll try to see what i can do, but for now i've not the time to investigate about this :disappointed: You may try to load the recaptcha library by hand on the concerned page maybe.

Regards,

nenes25 avatar May 17 '22 19:05 nenes25

Hello Nenes25,

Thank you very much for your answer. I'm going to look how to solve it with the clue you have given me. If I make it work I'll share here the process.

Regards, T

tga21 avatar May 18 '22 08:05 tga21

Hi, Nenes25

Marcin from iqit-commerce support team has given me a solution. He told me he edited some code from eicaptcha, so I have checked the files and here are the edits he made. I hope they can help someone else:

  1. In module's root, eicaptcha.php:

1.1 line 161:

if ($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1 to

if (Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1

1.2 line 185:

($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)

to

(Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)

1.3 line 211:

if (($this->context->controller instanceof ContactController && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)) {

to

if ((Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1)) {

1.3 line 227:

if (
        $this->context->controller instanceof ContactController
        && Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1
    ) {

to

Configuration::get('CAPTCHA_ENABLE_CONTACT') == 1

2 /eicaptcha/views/js/v3.js

$(document).ready(function () { $('.contact-form .form-fields').append(''); });

With this editions, the captcha validates in the form added with the templator builder for warehouse theme.

tga21 avatar May 18 '22 12:05 tga21

Hi @tga21 ,

Thanks for the share :smiley: ! I don't like the approach as the script are then loaded on every pages of the site which is unnecessary for most of the module user. I will think about adding a configuration which will allow this with a warning for performances.

Regards,

nenes25 avatar May 18 '22 15:05 nenes25

A new configuration add been added to the 2.4.5 version to allow to load recaptcha library on all pages. It should fix this issue, so i close it. Feel free to reopen if you still have an issue.

Regards,

nenes25 avatar Feb 20 '24 10:02 nenes25

Thanks @nenes25

tga21 avatar Feb 20 '24 10:02 tga21