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

 

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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