Jump to content

Captcha for contact form 1.4 stable


Recommended Posts

Hi

Hope someone can help, iam looking for an free captcha (contact form) that works with ver 1.4 stable ?
I tried the others thats available for earlier releases but with no success...

Any advice or info would be much appreciated!

Thank you

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 2 weeks later...
  • 4 weeks later...

Adding reCAPTCHA to contact form (for version 1.4.x)

- Create an account/login to https://www.google.com/recaptcha/

- Create public/private keys for your domain

- Download latest library from Google: http://recaptcha.googlecode.com/files/recaptcha-php-1.11.zip

- Unzip and (for ease of use) rename folder to recaptcha, delete example files so you end up with the folder structure:

 recaptcha
   LICENSE
   README
   recaptchalib.php



- Edit attached ContactController.php to enter public and private keys you obtained from Google

- Make a copy of /themes/[your theme]/contact-form.tpl

- Modify the original /themes/[your theme]/contact_form.tpl to add the contents of attached add_recaptcha.txt immediately above the code shown below, at the very bottom of the file

       <!-- insert contents of add_recaptcha.txt here -->


           <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large">


</form>
{/if}



- Upload recaptcha folder and its contents to the root of your installation

- Upload modified /themes/[your theme]/contact_form.tpl

- Upload ContactController.php to /override/controllers/ directory

- Test contact form

- If everything OK, delete /themes/[your theme]/contact_form.tpl copy you made

- User facing wording in add-recaptcha.txt can be modified to your liking before adding it to contact-form.tpl or in back office >> translations.

- add_recaptcha.txt uses a white theme. See http://code.google.com/apis/recaptcha/docs/customization.html for other colour themes and modify to your liking within script tag

var RecaptchaOptions = {
   theme : 'theme_name'
};

.

- It is possible to add more options within that scrip element. See above URL for extra options.

- The style element in add_recaptcha.txt is there to center the recaptcha, so it is optional.

<style type="text/css">
#recaptcha_area { margin: 0 auto;}
</style>



----
Edited to add:

I could turn this into a module but I cannot think of a clean way to modify the tpl file that will survive across updates and theme changes. I could:

- Backup and replace the theme tpl during module installation, but then a theme change must be hooked as well.

- Insert captcha code on the fly using JavaScript (since CAPTCHA required JavaScript to work anyway)

both of these seem messy solutions to me. Any ideas?

ContactController.php

add_recaptcha.txt

  • Like 3
Link to comment
Share on other sites

Adding reCAPTCHA to contact form (for version 1.4.x)

- Create an account/login to https://www.google.com/recaptcha/

- Create public/private keys for your domain

- Download latest library from Google: http://recaptcha.googlecode.com/files/recaptcha-php-1.11.zip

- Unzip and (for ease of use) rename folder to recaptcha, delete example files so you end up with the folder structure:
 recaptcha
   LICENSE
   README
   recaptchalib.php



- Edit attached ContactController.php to enter public and private keys you obtained from Google

- Make a copy of /themes/[your theme]/contact-form.tpl

- Modify the original /themes/[your theme]/contact_form.tpl to add the contents of attached add_recaptcha.txt immediately above the code shown below, at the very bottom of the file

       <!-- insert contents of add_recaptcha.txt here -->


           <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large">


</form>
{/if}



- Upload recaptcha folder and its contents to the root of your installation

- Upload modified /themes/[your theme]/contact_form.tpl

- Upload ContactController.php to /override/controllers/ directory

- Test contact form

- If everything OK, delete /themes/[your theme]/contact_form.tpl copy you made

- User facing wording in add-recaptcha.txt can be modified to your liking before adding it to contact-form.tpl or in back office >> translations.

- add_recaptcha.txt uses a white theme. See http://code.google.com/apis/recaptcha/docs/customization.html for other colour themes and modify to your liking within script tag

var RecaptchaOptions = {
   theme : 'theme_name'
};

.

- It is possible to add more options within that scrip element. See above URL for extra options.

- The style element in add_recaptcha.txt is there to center the recaptcha, so it is optional.

<style type="text/css">
#recaptcha_area { margin: 0 auto;}
</style>



----
Edited to add:

I could turn this into a module but I cannot think of a clean way to modify the tpl file that will survive across updates and theme changes. I could:

- Backup and replace the theme tpl during module installation, but then a theme change must be hooked as well.

- Insert captcha code on the fly using JavaScript (since CAPTCHA required JavaScript to work anyway)

both of these seem messy solutions to me. Any ideas?




Great post.I followed this and got a recaptcha working on the contact form .
Maybe a little change in code should make this work on other forms too.
Link to comment
Share on other sites

  • 3 months later...

I don't know why it is not working with 1.4.4.1. It has been in my TODO list to turn this into a module at some point though now I am not certain how useful CAPTCHAs will be after the paper by El Ahmad, Yan and Tayara. The whole thing seems like an exercise in futulity and p****ing off legitimate users. It is not really worth spending any time on it, and as long as it requires manually modifying core files, someone will have problems with it. I will come back to it if Prestashop devs adds a hook to the contact form ( a couple of lines for them). Harass them and I will build a module for you if it the hook is added :)

  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...

I found this thread by searching for a captcha for the contact form too.

After reading that paper (link in reply 12) it got me thinking...

I wonder how hard it would be to put a picture in the form with a field where the user must type in the object in the picture. If it was a static picture that would be really simple and it would be far less of an inconvenience that trying to get those recaptchas figured out.

 

For example, if there was a picture of a bear. Users would type in "bear" in the field in order to get the form to submit. Of course it could be set up for different languages too.

Link to comment
Share on other sites

  • 6 months later...

thank you for the great post. i am using prestashop 1.4.8.2, i have followed the instruction to recaptcha on the contact form.

recaptcha is not showing up on the contact form but when i send test message, it give error that " incorrect response to CAPTCHA challenge. Please try again ". any idea why it's not showing up on the contact form.

Link to comment
Share on other sites

You must Follow the directions closely I have had a working Captcha from this exact post for some time.

Make sure when you create your Captcha account that you have the correct url to your site.

Be sure that you have pasted the Public and Private keys correctly into the ContactController.php file.

Make sure you have a recaptcha folder in the root of the shop with the recaptchalib.php file inside.

This has worked for me in 1.4.6.8 - 1.4.8.2

 

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Thanks tdr170, it's working now. followed step by step and removed the memory cache. it worked perfactly

 

You must Follow the directions closely I have had a working Captcha from this exact post for some time.

Make sure when you create your Captcha account that you have the correct url to your site.

Be sure that you have pasted the Public and Private keys correctly into the ContactController.php file.

Make sure you have a recaptcha folder in the root of the shop with the recaptchalib.php file inside.

This has worked for me in 1.4.6.8 - 1.4.8.2

 

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 5 weeks later...

Adding reCAPTCHA to contact form (for version 1.4.x)

 

- Create an account/login to https://www.google.com/recaptcha/

 

- Create public/private keys for your domain

 

- Download latest library from Google: http://recaptcha.goo...ha-php-1.11.zip

 

- Unzip and (for ease of use) rename folder to recaptcha, delete example files so you end up with the folder structure:

 recaptcha
LICENSE
README
recaptchalib.php

 

- Edit attached ContactController.php to enter public and private keys you obtained from Google

 

- Make a copy of /themes/[your theme]/contact-form.tpl

 

- Modify the original /themes/[your theme]/contact_form.tpl to add the contents of attached add_recaptcha.txt immediately above the code shown below, at the very bottom of the file

	<!-- insert contents of add_recaptcha.txt here -->


		<input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large">



</form>
{/if}

 

- Upload recaptcha folder and its contents to the root of your installation

 

- Upload modified /themes/[your theme]/contact_form.tpl

 

- Upload ContactController.php to /override/controllers/ directory

 

- Test contact form

 

- If everything OK, delete /themes/[your theme]/contact_form.tpl copy you made

 

- User facing wording in add-recaptcha.txt can be modified to your liking before adding it to contact-form.tpl or in back office >> translations.

 

- add_recaptcha.txt uses a white theme. See http://code.google.c...tomization.html for other colour themes and modify to your liking within script tag

var RecaptchaOptions = {
theme : 'theme_name'
};

.

 

- It is possible to add more options within that scrip element. See above URL for extra options.

 

- The style element in add_recaptcha.txt is there to center the recaptcha, so it is optional.

<style type="text/css">
#recaptcha_area { margin: 0 auto;}
</style>

 

----

Edited to add:

 

I could turn this into a module but I cannot think of a clean way to modify the tpl file that will survive across updates and theme changes. I could:

 

- Backup and replace the theme tpl during module installation, but then a theme change must be hooked as well.

 

- Insert captcha code on the fly using JavaScript (since CAPTCHA required JavaScript to work anyway)

 

both of these seem messy solutions to me. Any ideas?

 

Hello,

 

i have a problem after the submit :

 

white page in this message : "Could not open socket"

 

thank you for your help !

 

Michael

Link to comment
Share on other sites

I followed the instructions below and got it working perfectly. However, i actually tried all the steps a few times as the box and send button was not showing up at first and then i cleared the smarty cache & compile & and then everything worked. (should have thought of that earlier :P ) Thanks so much for the tips phrasespot!

 

Btw, could anyone be able to tell me how to move the captcha box to the middle of the form as it's now on the left? Also, can i use it on more then 1 form? I tried adding it to productquestion.tpl as well but only the text showed up.

 

Thanks in advance!

 

 

Adding reCAPTCHA to contact form (for version 1.4.x)

 

- Create an account/login to https://www.google.com/recaptcha/

 

- Create public/private keys for your domain

 

- Download latest library from Google: http://recaptcha.googlecode.com/files/recaptcha-php-1.11.zip

 

- Unzip and (for ease of use) rename folder to recaptcha, delete example files so you end up with the folder structure:

recaptcha
LICENSE
README
recaptchalib.php

 

- Edit attached ContactController.php to enter public and private keys you obtained from Google

 

- Make a copy of /themes/[your theme]/contact-form.tpl

 

- Modify the original /themes/[your theme]/contact_form.tpl to add the contents of attached add_recaptcha.txt immediately above the code shown below, at the very bottom of the file







{/if}

 

- Upload recaptcha folder and its contents to the root of your installation

 

- Upload modified /themes/[your theme]/contact_form.tpl

 

- Upload ContactController.php to /override/controllers/ directory

 

- Test contact form

 

- If everything OK, delete /themes/[your theme]/contact_form.tpl copy you made

 

- User facing wording in add-recaptcha.txt can be modified to your liking before adding it to contact-form.tpl or in back office >> translations.

 

- add_recaptcha.txt uses a white theme. See http://code.google.com/apis/recaptcha/docs/customization.html for other colour themes and modify to your liking within script tag

var RecaptchaOptions = {
theme : 'theme_name'
};

.

 

- It is possible to add more options within that scrip element. See above URL for extra options.

 

- The style element in add_recaptcha.txt is there to center the recaptcha, so it is optional.


 

----

Edited to add:

 

I could turn this into a module but I cannot think of a clean way to modify the tpl file that will survive across updates and theme changes. I could:

 

- Backup and replace the theme tpl during module installation, but then a theme change must be hooked as well.

 

- Insert captcha code on the fly using JavaScript (since CAPTCHA required JavaScript to work anyway)

 

both of these seem messy solutions to me. Any ideas?

Edited by giokookie (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

I don't know why it is not working with 1.4.4.1. It has been in my TODO list to turn this into a module at some point though now I am not certain how useful CAPTCHAs will be after the paper by El Ahmad, Yan and Tayara. The whole thing seems like an exercise in futulity and p****ing off legitimate users. It is not really worth spending any time on it, and as long as it requires manually modifying core files, someone will have problems with it. I will come back to it if Prestashop devs adds a hook to the contact form ( a couple of lines for them). Harass them and I will build a module for you if it the hook is added :)

 

thanks for your detailed explanation how to add this to the contact form, works like a charme. just 1 more question, does the very same approach apply to the sendtofriend.tpl as well by just adding the code part to that tpl?

 

phil

Link to comment
Share on other sites

  • 5 months later...

Congratulations for you!! Right now I found and make the installation of Captcha Module for FREE, you can find it on www.zprofess.com They have great technical support and great service! I recommend it.

 

Thanks all and regards,

 

FAHR

 

I just try the zprofess with prestashop v1.5.4.1,

the contact Captcha fail to work when cache turn on, it uses js to add it on the fly

the registration captcha also fail to work, it only display.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 3 months later...

hi guys - first - thanks for a great post - but, for me - just like eeeeeeverything else, it didn't seem to work. Things never go smoothly for me on these things.

 

couple of questions. on the attached ContactController - where the key's go. do we keep or remove the ' around the 'put publick key here'

 

also - on my contact form, it shows the COPY of the add_recaptcha.txt but not the typical distorted words one see's on a captcha.

 

my form submits just fine - but i never see the captcha screen. any ideas where i dropped the ball?

 

thanks again for a great post - i look forward to quickly resolving this issue.

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

This is no longer working correctly since Google have updated the recaptcha to version 2, and are discontinuing version 1 before the end of March 2018.

Does anybody know how to update the code so this works with the new version 2 recaptcha?

This would be good to have for older versions of Prestashop since the recent russian spam emails coming from the insecure contact form.

 

thanks

Link to comment
Share on other sites

  • 1 year later...
On 3/7/2018 at 12:59 PM, Lee said:

This is no longer working correctly since Google have updated the recaptcha to version 2, and are discontinuing version 1 before the end of March 2018.

Does anybody know how to update the code so this works with the new version 2 recaptcha?

This would be good to have for older versions of Prestashop since the recent russian spam emails coming from the insecure contact form.

 

thanks

Hello,

Did you find a solution? I have the same problem.

Link to comment
Share on other sites

  • 3 months later...

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...