Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home How To Plone 3 Plone ReCaptcha on Contact Form

Plone ReCaptcha on Contact Form

How to use ReCaptcha on the Contact Form

 

This page is still under construction in terms of formatting and elaboration, but is complete in terms of instructions.

 

1. Go to http://recaptcha.net
2. Log into your google account
3. Generate new keys for your site -- google will remember these for when you need them later
4. stop your plone instance ./bin/instance stop
5. Navigate to zinstance, edit buildout.cfg and, within [buildout], add collective.recaptcha under eggs=, and add collective.recaptcha under zcml=
6. in your zinstance, run ./bin/buildout -- wait
7. start your plone instance
8. got to http://path/to/site/@@recaptcha-settings and enter the public and private keys
9. navigate toportal_skins/plone_templates/contact-info/manage_main and hit "customize" button
10. After

<textarea name="message"
id="message"
rows="5"
cols="25"
tal:content="request/message|nothing"
> </textarea>
</div>


Put in this

<div class="field"
tal:define="error errors/captcha| nothing;"
tal:attributes="class python:test(error, 'field error', 'field')">

<label i18n:translate="label_captcha_help">Verification Code</label>

<span class="fieldRequired" title="Required"
i18n:attributes="title title_required;"
i18n:translate="label_required">(Required)</span>

<div class="formHelp" i18n:translate="help_plone_captcha">
This helps me prevent automated spamming.
</div>

<div tal:content="error">Validation error output</div>
<tal:block tal:replace="structure context/@@captcha/image_tag"/>
</div>

 

11. Go to portal_skins/plone_form_scripts/validate_site_feedback/manage_main and hit "customize" button
12. After

if not (message and message.strip()):
state.setError('message', _(u'Please enter a message'), 'message_required')

Put in this

if not context.restrictedTraverse('@@captcha').verify():
state.setError('captcha', _(u'The captcha failed. Please try again.'), 'message_required')

After all that, the contact-info file will look something like this file.