Jump to content

Recommended Posts

Hi

Would like to share how i implemented google recaptcha v2 on Prestashop 1.7

 

1. Go to Google recaptcha and create keys for your website.

2. Edit /public_html/modules/contactform/views/templates/widget/

contactform.tpl Insert ff lines before:

 <footer class="form-footer text-xs-right">
      <input class="btn btn-primary" type="submit" name="submitMessage" value="{l s='Send' d='Shop.Theme.Actions'}">
    </footer>

// insert lines  replace your_key with your keys

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

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

3. Edit  /modules/contactform/contactform.php

insert after:

 $this->context->controller->errors[] = $this->trans('Invalid email address.', array(), 'Shop.Notifications.Error');

// insert text

} elseif (!($gcaptcha = (int)(Tools::getValue('g-recaptcha-response')))) {
  $this->context->controller->errors[] = $this->trans('Captcha Error', array(), 'Shop.Notifications.Error');

 

Enjoy!

If you found this helpful,

 

 

 

Share this post


Link to post
Share on other sites

Very bad solution ^^
I can send an invented value for the g-recaptcha-response.

http://your_site.com/index.php?controller=contact&submitMessage=1&url=&contactKey=123456&message=Recaptcha%20does%20not%20work!&email=recaptcha@example.com&id_contact="+id_contact+"&g-recaptcha-response=faked


Your code does not protect anything.

The verification must be done directly with Google servers

  • Like 1

Share this post


Link to post
Share on other sites
On 06/03/2018 at 8:26 AM, selectshop.at said:

Here is an efficient and working Google recaptcha module:

For PS 1.6. - https://github.com/nenes25/eicaptcha/releases/tag/0.4.12

For PS 1.7. - https://github.com/nenes25/eicaptcha/releases/tag/2.0.3


Hello,

Thanks for the link, it is better not to directly give link to the release as they keep moving, and i'm thinking of removing the old ones ;)
for now :
version 0.4.x is for prestashop < 1.7
2.x for prestashop 1.7

Regards,

Share this post


Link to post
Share on other sites
On 3/6/2018 at 3:26 PM, selectshop.at said:

Here is an efficient and working Google recaptcha module:

For PS 1.6. - https://github.com/nenes25/eicaptcha/releases/tag/0.4.12

For PS 1.7. - https://github.com/nenes25/eicaptcha/releases/tag/2.0.3

Hi there,

I downloaded your module for 1.7 and tried to upload it and it failed during installation

 

image.png.d2c148b10a124886845bbfdc2297890a.png

Share this post


Link to post
Share on other sites

@ archproject - at first I'm not the developer of that module. Try the latest version: https://github.com/nenes25/eicaptcha/releases/latest

Version 2.04. is latest for PS 1.7.

If you are having issues:

On 7.3.2018 at 1:56 PM, selectshop.at said:

You can add issues you are having here: https://github.com/nenes25/eicaptcha/issues

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Working on 1.7.3.0 from @selectshop.at download link. But showed only at new user registration - not at contact form.

How I can place Captcha to Contact form too?

Please help

Share this post


Link to post
Share on other sites
On 4/1/2018 at 8:14 AM, selectshop.at said:

@ archproject - at first I'm not the developer of that module. Try the latest version: https://github.com/nenes25/eicaptcha/releases/latest

Version 2.04. is latest for PS 1.7.

Just wanted to inform people, I tried this module with my PS 1.7.6 with warehouse theme. Simply installed, configured with the keys from google and saved, everything works as expected in frontend. I can see captcha on both account creation and contact form. I didn't edit any codes.

Although on the plugin configuration page, when I click "Check if module is well installed", it says:
 

Quote

 

Errors

contacform.php override does not exists

 

All the best!

 

 

Share this post


Link to post
Share on other sites
On 3/6/2018 at 8:26 AM, selectshop.at said:

Here is an efficient and working Google recaptcha module:

For PS 1.6. - https://github.com/nenes25/eicaptcha/releases/tag/0.4.12

For PS 1.7. - https://github.com/nenes25/eicaptcha/releases/tag/2.0.3

Tnx a lot!

I installed it on presta 1.7.2.4 and working well! For install this module u need the official "contact form" module installed (it's free).

This captcha module it's compatible only the V2 protection (not V3).

Have a good day :)

Share this post


Link to post
Share on other sites
On 4/1/2018 at 6:14 AM, selectshop.at said:

@ archproject - at first I'm not the developer of that module. Try the latest version: https://github.com/nenes25/eicaptcha/releases/latest

Version 2.04. is latest for PS 1.7.

If you are having issues:

 

 

THANK YOU!! That saved me from bots creating new users on our website without paying 60€ for such a simple thing. Thanks a lot!!

Share this post


Link to post
Share on other sites

Work good for me in 1.6 but only with recaptcha V2, not V3

Share this post


Link to post
Share on other sites

Wow, that's great! 😃

But will there also be functionality for customer registration? Unfortunately, that's my bigger problem with bots.

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/4/2020 at 10:32 PM, Gummiwutzel said:

Wow, that's great! 😃

But will there also be functionality for customer registration? Unfortunately, that's my bigger problem with bots.

If you are using PS 1.7.1+

then you can implement the above V3 procedure for the customer registration page also with the new hook actionSubmitAccountBefore

Edit: Without core overrides*

 

Edited by hamsn
Added additional point (see edit history)

Share this post


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

If you are using PS 1.7.1+

then you can implement the above V3 procedure for the customer registration page also with the new hook actionSubmitAccountBefore

OK.

How can I do that?

Share this post


Link to post
Share on other sites
On 5/4/2020 at 6:54 AM, luishuaymana said:

Hello, I can recommend an invisible recaptcha v3 module.
The following article in Spanish explains it fully:
https://prestademia.com/recaptcha_v3_invisble
And if you want to see how it is configured I also leave you the link of the video:
https://www.youtube.com/watch?v=i3ZUU9mzrVk

Thank you for your work @luishuaymana

I created a sub-branch to your project main branch: https://github.com/hamsn/pdrecaptcha/tree/with_customer_reg

I implemented the functionality on the customer registration page too. Once tested and confirmed working, we can merge with the main branch.

 

@Gummiwutzel

If you have version 1.7.1 or above, you can download and try the module from link above.

Module tested on PS 1.7.6.4

 

 

pdrecaptcha-cust-reg.jpg

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/9/2020 at 12:17 PM, hamsn said:

Thank you for your work @luishuaymana

I created a sub-branch to your project main branch: https://github.com/hamsn/pdrecaptcha/tree/with_customer_reg

I implemented the functionality on the customer registration page too. Once tested and confirmed working, we can merge with the main branch.

 

@Gummiwutzel

If you have version 1.7.1 or above, you can download and try the module from link above.

Module tested on PS 1.7.6.4

 

 

 

Hi, I tried to download this module, but when I upload it in the backoffice the error "Ooops Upload failed" appears. Error details: This file does not appear to be a valid zip form

I use PS 1.7.5.2.

To download the module I clicked on Clone or Download -> Download ZIP on the github page

Edited by Mattia98 (see edit history)

Share this post


Link to post
Share on other sites
7 minutes ago, Mattia98 said:

Hi, I tried to download this module, but when I upload it in the backoffice the error "Ooops Upload failed" appears. Error details: This file does not appear to be a valid zip form

I use PS 1.7.5.2.

To download the module I clicked on Clone or Download -> Download ZIP on the github page

I suppose it has to do with the folder name generated by github. It needs to be pdrecaptcha.
For simplicity, I have created ready zip file to upload and install: https://github.com/hamsn/pdrecaptcha/blob/with_customer_reg/pdrecaptcha.zip

Download the file above and try it.

Best regards.

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
21 hours ago, Mattia98 said:

Thank you so much! Now it works

Please report back to let the community know if it works and you do not have fake registrations/accounts.

Thank you.

Share this post


Link to post
Share on other sites

Hi @hamsn,

Ei Captcha is a great module and it works perfect for contact and account registration form (Presta 1.7). Thanks very much for that!

Is there any possibility you could add as well a captcha option for the newsletter sign-up on the main page?
Currently we have so many bot visits that simply go to our homepage and add their email in the newsletter subscription box and submit. So we end up with loads of fake emails.

Thanks,

Phil

Share this post


Link to post
Share on other sites
On 5/19/2020 at 9:24 AM, hamsn said:

I suppose it has to do with the folder name generated by github. It needs to be pdrecaptcha.
For simplicity, I have created ready zip file to upload and install: https://github.com/hamsn/pdrecaptcha/blob/with_customer_reg/pdrecaptcha.zip

Download the file above and try it.

Best regards.

Added this to my site, recently (and finally) moved from a decades old oscommerce because the bot issue was unreal.  THANK YOU for this module!

Share this post


Link to post
Share on other sites

Thank you @hamsn. My site went live for only 3 days and I started getting spam e-mails through the contact form (PS 1.7.6.4). I have implemented on my site and it worked. I agree with @Carbone, newsletter subscription needs to be protected as well. 

Share this post


Link to post
Share on other sites
Posted (edited)
On 8/28/2019 at 12:17 AM, hamsn said:

@ archproject - at first I'm not the developer of that module. Try the latest version: https://github.com/nenes25/eicaptcha/releases/latest

Version 2.04. is latest for PS 1.7.

Just wanted to inform people, I tried this module with my PS 1.7.6 with warehouse theme. Simply installed, configured with the keys from google and saved, everything works as expected in frontend. I can see captcha on both account creation and contact form. I didn't edit any codes.

Although on the plugin configuration page, when I click "Check if module is well installed", it says:

This is not showing for me on the contact form only sign up, PS version 1.7.6.5 using 2.04. installs fine I configured it, it shows on the sign up form but not the contact us form,  I am wanting to use the v2 recaptcha

Edited by dragon_sa (see edit history)

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

×
×
  • Create New...

Important Information

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