en Jump to content
motion2082

Add reCAPTCHA to Prestashop Version 1.6.0.14 for FREE

Recommended Posts

Hello Hervé..
Thank you very much for your module.
 

I just new installed this module, on prestashop 1.7.2.0.

its work for Captcha for account creation, but error on Captcha for contact form, reCaptcha not displayed.

How to fix it? i am sorry for my English.

Share this post


Link to post
Share on other sites

 

Hello Hervé..
Thank you very much for your module.
 

I just new installed this module, on prestashop 1.7.2.0.

its work for Captcha for account creation, but error on Captcha for contact form, reCaptcha not displayed.

How to fix it? i am sorry for my English.

 

Hello,

In order to work with prestashop 1.7 you have to install the module contactform before.

Have you do this, do you use a custom theme ?

 

Regards,

Share this post


Link to post
Share on other sites

Attention the module eicaptcha-master.zip contains the module sendtoafriend do not install it!

If you had read the documentation of the module before posting , you should have seen that the module overrides functionnalities of the module sendtoafriend in order to add a captcha on it.

And that this override have to be done manually.

 

So please avoid to tell nosense things if you do not understand how it works...

Share this post


Link to post
Share on other sites

First of all, thank you for this module, quite surprised it is not already included in "stock" PS. Currently using v 1.7.2 and your version downloaded from here: https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-beta.zip

 

It is now being displayed correctly on both forms, however it doesn't seem to work as I was able to send message using the contact us form without validating captcha. There is even message being displayed after submit - Your message has been successfully sent to our team. And the message is recorded in BO.

 

Perhaps I missed something in settings...?

Edited by mr_absinthe

Share this post


Link to post
Share on other sites

Hi

Very nice contribution. There's just one comment from our side: you should move the javascript code (//Insertion de la div qui va contenir le captcha dans la page) out from the main PHP and have it in a separate file, as once installed, it is cached, and no changes to the script are taken into consideration, not even after re-install.

Cheers

Share this post


Link to post
Share on other sites
On 06/04/2016 at 3:43 PM, sekwoja said:

I believe that there is some problem with controller, because eicaptcha.php in reference to contact form adds only couple of lines written in Javascript (jQuery). And above-mentioned code does nothing more than inputting recaptcha google api by means of JS/jQuery:


$(document).ready(function(){
            
               //Add div where the captcha will be displayed
               $(".submit").before("<div id=\"captcha-box\"></div>");
               
               //Manage form submit
                $("#submitMessage").click(function(){
                    //If no response we display an error
                    if ( ! grecaptcha.getResponse() ) {
                        $.ajax({
                                method : "POST",
                                url : "'._MODULE_DIR_.$this->name.'/eicaptcha-ajax.php",
                                data : "action=display_captcha_error",
                                success : function(msg){
                                    $(".'.$error_class.'").remove();    
                                    $("form.'.$form_class.'").before(msg);
                                }
                            });
                       
                        return false;
                    }
                });
            });

This solution may be helpful for some other users having issues with reCaptcha on Prestashop. So, after hours of tries I gave up and took code delivered by google (this one below) and put it inside my header.tpl.


<script src='https://www.google.com/recaptcha/api.js'></script>

Than I copied and pasted this:


<div class="g-recaptcha" data-sitekey="GOOGLE_PUBLIC_KEY"></div>

into contact-form.tpl in my theme. After couple of tries it turned out that it still doesnt work so I opened contactController.php and added:


else   if   ( ! ( $gcaptcha   =   ( int ) ( Tools:: getValue ( 'g-recaptcha-response' ) ) ) )

$this -> errors [ ]   =   Tools:: displayError ( 'Captcha nie zweryfikowana' ) ;

before last else in line 50 in public function postProccess.

 

Now it works. I am still wondering what is wrong with EiCaptcha module, because when it comes to create account page it works like a charm. The only one problem is on contact form page.

 

it is not very clear from the OP how to use this module to provide the complete security needed, because if you do have a real spam problem then they still bypass the captcha on the contact form even after installing this module and following the first post.

so, I wanted to make it clear, that not only do you need to follow the first post of this thread, but you will also need to write in the code from the quoted post above and into to the contactcontroller.php

the response from the JS however is in another language, but someone else also found this solution too which can be found here: https://www.prestashop.com/forums/topic/609900-spammer-bypasses-contact-form-captcha-no-effect/?do=findComment&comment=255718

 

now, i tried the solution that is provided in the link above, but it didn't work at first, but after comparing both codes I was able to establish that it has a "{" "}" in the code 

example

} else if (!($gcaptcha = (int)(Tools::getValue('g-recaptcha-response')))){

    $this->errors[] = Tools::displayError('Captcha not verified');

            }

that code above didn't work, it just threw the contact page but the below code is what worked for me on 1.6.0.14

 else if (!($gcaptcha = (int)(Tools::getValue('g-recaptcha-response'))))

    $this->errors[] = Tools::displayError('Captcha not verified');

although the OP of this thread tells you to put the following code into the contact page 

<script src=https://www.google.com/recaptcha/api.js'></script>

it might need to go into the header.tpl, I can't be certain if this makes a difference or not, but most certainly updating the controller was needed in order to stop the spamming.

 

thank you to all the contributors for your solutions. I would just like to add that it would be very handy if the OP can edit the first post to include the solutions so it can save PS users a lot of time. and possible damage to reputation.

 

Share this post


Link to post
Share on other sites

If anyone is having problems with module not appearing in BO - this might be the case of UPPERCASE or lowercase module folder name - if the module is not appearing, rename "EICAPTCHA" to "eicaptcha"!

This happens to some hosting providers using certain OS for servers - if Your hosting provider uses Linux/Unix, "EICAPTCHA" folder name will cause the error and module will not be visible in BO.

Share this post


Link to post
Share on other sites

If You want to choose Captcha interface language:

1. Open file "eicaptcha.php" inside the module folder (using "Notepad" or "Notepad++");

2. Find this part of the code at the end of the file (actual line is around 306):

		$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>';

Edit the very end by adding "&hl=FR", where FR is French - just pick Your language code respectively. Should look like this:

		$js .= '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=fr" async defer></script>';

You can pick whichever language You want. This change will work for contact form only - You need to change the code lines for Account creation, Send to a Friend by finding same code lines with "recaptcha/api.js" and adding the small code segment.

Share this post


Link to post
Share on other sites

Hi, thank you so much, works for me 1.6.1.4 but shows the following error:

Notice: Undefined index: captcha in /home/web/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 253

Notice: Trying to get property of non-object in /home/web/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 253

Anyone can help me please? Thanks!

Share this post


Link to post
Share on other sites
On 9/3/2017 at 2:47 AM, mr_absinthe said:

First of all, thank you for this module, quite surprised it is not already included in "stock" PS. Currently using v 1.7.2 and your version downloaded from here: https://www.h-hennes.fr/blog/wp-content/uploads/2017/07/eicaptcha-17-beta.zip

 

It is now being displayed correctly on both forms, however it doesn't seem to work as I was able to send message using the contact us form without validating captcha. There is even message being displayed after submit - Your message has been successfully sent to our team. And the message is recorded in BO.

 

Perhaps I missed something in settings...?

this module working fine with prestashop 1.7.2.4

for spamming will notify here.

thanks for this module.

No spamming now

Edited by tuhingr
Module working reports

Share this post


Link to post
Share on other sites

Hello , 

Can you help me? I have this error: 

Uncaught Error: ReCAPTCHA placeholder element must be empty
    at Object.Qr [as render] (VM5826 recaptcha__pt_pt.js:396)
    at onloadCallback (contacte-nos:1296)
    at VM5826 recaptcha__pt_pt.js:400
    at Br (VM5826 recaptcha__pt_pt.js:391)
    at VM5826 recaptcha__pt_pt.js:400
    at VM5826 recaptcha__pt_pt.js:411

Share this post


Link to post
Share on other sites
On 20/02/2018 at 6:02 AM, sting5 said:

If anyone is having problems with module not appearing in BO - this might be the case of UPPERCASE or lowercase module folder name - if the module is not appearing, rename "EICAPTCHA" to "eicaptcha"!

This happens to some hosting providers using certain OS for servers - if Your hosting provider uses Linux/Unix, "EICAPTCHA" folder name will cause the error and module will not be visible in BO.


Thanks for the feeback it's weird i've never had such a problem.

Share this post


Link to post
Share on other sites

Excellent Module, thank you so much!

It works out of the Box if you do the "composer thing" asked by the module when you install it.
I managed to fight off a spammer who flooded my contact form with spam. I have tested it with PS 1.6.1.13, 1.6.1.14 and 1.6.1.16
There is also a version for PS 1.7 if you search in Github.

Share this post


Link to post
Share on other sites
On 23/2/2018 at 7:08 PM, mr_absinthe said:

I've upgraded to the latest version and it is working fine in 1.7.2, thank you very much! Great job!

Hi,

 

I installed  the latest version of the module on PS 1.7.2 but I have always this message: 

  • Please validate the captcha field before submitting your request

I don't know how to fix it :(

 

Thanks

Angela

 

Share this post


Link to post
Share on other sites
1 hour ago, afshop said:

Hi,

 

I installed  the latest version of the module on PS 1.7.2 but I have always this message: 

  • Please validate the captcha field before submitting your request

I don't know how to fix it :(

 

Thanks

Angela

 

 I solved it; I setup the parameter  allow_url_fopen=on in php.ini

 

thanks

 

Share this post


Link to post
Share on other sites

Just wanted to say a big THANK YOU for this great module!

It took me only a minute to configure by following the steps in the first post.  Tested on 1.6.5.

Share this post


Link to post
Share on other sites

After install and paste code on contact-form.tpl reCapcha is showing. When try to submit without check "im not robot" capcha work and don't send message, but when check the box and submit show blank white page and not sent message, please help

Edited by loyalconsult

Share this post


Link to post
Share on other sites

Many thanks for this. My site has also been hit by a burst of Russian spam and I came across this. 

Registered with Google and installed on Prestashop 1.6.0.9 in the default-bootstrap them 

Worked fine.; Thanks again.

 

Share this post


Link to post
Share on other sites

Google ReCaptcha V2 is not the solution, because it is broken now...

"The researcher East-Ee Security devised a proof of concept bypass of the Google’s reCaptcha V2 verification system dubbed ReBreakCaptcha."

http://securityaffairs.co/wordpress/56816/hacking/rebreakcaptcha-google-recaptcha-hacking.html

It can be broken by any "anti captcha" services.

Share this post


Link to post
Share on other sites

Welcome
I have a problem with the installation of this module 

want to use captcha version 2

after entering a public and private key in the module configuration 

there is a problem with the key on the page 

http://e-dimar.pl/kontakt

presta version 1.6.1.6

 

please help me 

Share this post


Link to post
Share on other sites

Hi,

I have installed this on Prestashop version 1.6.1.9 and it works fine thank you!

Just wondering if there is a version that works with invisible recaptcha?

Thanks,

Share this post


Link to post
Share on other sites
On 4/6/2016 at 10:43 PM, sekwoja said:

I believe that there is some problem with controller, because eicaptcha.php in reference to contact form adds only couple of lines written in Javascript (jQuery). And above-mentioned code does nothing more than inputting recaptcha google api by means of JS/jQuery:


$(document).ready(function(){
            
               //Add div where the captcha will be displayed
               $(".submit").before("<div id=\"captcha-box\"></div>");
               
               //Manage form submit
                $("#submitMessage").click(function(){
                    //If no response we display an error
                    if ( ! grecaptcha.getResponse() ) {
                        $.ajax({
                                method : "POST",
                                url : "'._MODULE_DIR_.$this->name.'/eicaptcha-ajax.php",
                                data : "action=display_captcha_error",
                                success : function(msg){
                                    $(".'.$error_class.'").remove();    
                                    $("form.'.$form_class.'").before(msg);
                                }
                            });
                       
                        return false;
                    }
                });
            });

This solution may be helpful for some other users having issues with reCaptcha on Prestashop. So, after hours of tries I gave up and took code delivered by google (this one below) and put it inside my header.tpl.


<script src='https://www.google.com/recaptcha/api.js'></script>

Than I copied and pasted this:


<div class="g-recaptcha" data-sitekey="GOOGLE_PUBLIC_KEY"></div>

into contact-form.tpl in my theme. After couple of tries it turned out that it still doesnt work so I opened contactController.php and added:


else   if   ( ! ( $gcaptcha   =   ( int ) ( Tools:: getValue ( 'g-recaptcha-response' ) ) ) )

$this -> errors [ ]   =   Tools:: displayError ( 'Captcha nie zweryfikowana' ) ;

before last else in line 50 in public function postProccess.

 

Now it works. I am still wondering what is wrong with EiCaptcha module, because when it comes to create account page it works like a charm. The only one problem is on contact form page.

You're a heaven-sent. <3

Share this post


Link to post
Share on other sites

Does the Invisible. reCAPTCHA work with this module? And is it advised not to use your email in clean text on your website?

Share this post


Link to post
Share on other sites

Hello,

It's not yet planned to used invisible recaptcha.
Maybe in next version, but before, i want to empty all the remaining issues on github.

Regards,

Share this post


Link to post
Share on other sites

I installed this on multiple prestashop installs (older 1.4, 1.5 and 1.6). I tested if the recaptcha worked, all worked perfect. Unfortunately I still receive massive russian spam .

Share this post


Link to post
Share on other sites

 

On 12.3.2018 at 11:38 AM, webmaster@prestashop said:

 

Same for me too. I use PrestaShop-Version 1.6.1.5

 

Same here with 1.6.1.17

 

README.md is not a valid module name.

Share this post


Link to post
Share on other sites

HI,

I am not able to install the module... I have uploaded the .zip by ftp, extracted it in themes\Calisto\modules and when I go to PS admin to install it, I have the following error:

[PrestaShop] Fatal error in module file :/home2/amalieco/public_html/classes/module/Module.php(2794) : eval()'d code:
require_once(): Failed opening required '/home2/amalieco/public_html/classes/module/../../../modules/recaptcha/lib/recaptchalib.php' (include_path='/home2/amalieco/public_html/tools/htmlpurifier/standalone:.:/opt/alt/php71/usr/share/pear')

I have done the same in themes\default-bootstrap\modules and I have the same fatal error... And I have read all the comments and your web, but I don't find anything related.

Could you please help me? PS Version: 1.6.18 and Module version: 0.4.11

With version 0.4.13 I can't even see it in the admin

Thanks!

Edited by driu7

Share this post


Link to post
Share on other sites
On 16/3/2018 at 4:25 PM, hhennes said:

Hi,
Please download the module from the release page : https://github.com/nenes25/eicaptcha/releases
And upload it directly from the module page in the backoffice.

Regards,

 

Hi again,

Yes, I tried this too and it didn't work either. Both paths: uploading in PS administration or uploading manually and extracting the files do the same for me, when I press the button "Install" in PS administration I have this error.... Any idea?

Thank you very much

 

blob.png.cace39f97fa7430ffa14f7765fd9fe11.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More