Skip to main content

Human readable captcha for z3cform

Project description

Introduction

collective.z3cform.norobots provides a “human” captcha widget based on a list of questions/answers.

This captcha can be used as a plone.app.discussiom captcha plugin.

The widget is based on z3c.form.TextWidget.

Requirements

  • tested with Plone 4.0 as a plugin for plone.app.discussion, should work with Plone 3

  • plone.app.z3cform

Installation

Just a simple easy_install collective.z3cform.norobots is enough.

Alternatively, buildout users can install collective.z3cform.norobots as part of a specific project’s buildout, by having a buildout configuration such as:

[buildout]
...
eggs =
    collective.z3cform.norobots
...
[instance]
...
zcml =
    collective.z3cform.norobots

In portal_setup, apply the profile collective.z3cform.norobots:default.

Add a new question

In the Plone Property Sheet “norobots_properties” (portal_properties/norobots_properties), add a new property:

Name: The question id (ex: "question4")
Value: your_question::the_answer (ex: "What is 10 + 12 ?::22")
Type: string

Usage

You can use this widget setting the “widgetFactory” property of a form field:

from zope import interface, schema
from z3c.form import interfaces, form, field, button, validator
from plone.app.z3cform.layout import wrap_form

from collective.z3cform.norobots.i18n import MessageFactory as _
from collective.z3cform.norobots.widget import NorobotsFieldWidget
from collective.z3cform.norobots.validator import NorobotsValidator

class INorobotsForm(interface.Interface):
    norobots = schema.TextLine(title=_(u'Are you a human ?'),
                               description=_(u'In order to avoid spam, please answer the question below.'),
                               required=True)

class NorobotsForm(form.Form):
    fields = field.Fields(INorobotsForm)
    fields['norobots'].widgetFactory = NorobotsFieldWidget

# wrap the form with plone.app.z3cform's Form wrapper
NorobotsFormView = wrap_form(NorobotsForm)

# Register Norobots validator for the correponding field in the IContactInfo interface
validator.WidgetValidatorDiscriminators(NorobotsValidator, field=INorobotsForm['norobots'])

for more information see contact_info.py in the plone_forms directory in the package.

Possible problems

Changelog

1.2 (2010-10-31)

  • Fix tests for Plone 4 [sylvainb]

1.1 - 2010-09-15

  • Support for using as a plone.app.discussiom captcha plugin (Plone 4) [Petri Savolainen]

  • Finnish translations [Petri Savolainen]

1.0

  • Initial release [sylvainb]

Credits

makinacom

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.z3cform.norobots-1.2.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file collective.z3cform.norobots-1.2.tar.gz.

File metadata

File hashes

Hashes for collective.z3cform.norobots-1.2.tar.gz
Algorithm Hash digest
SHA256 6e97b4bb6fed971a7fefe1098d5f74d6f34186c998baa9052708f6cefe65cdb0
MD5 f4959a175cb5e428df9174b10cb5dc54
BLAKE2b-256 f8defcdafee6388600a2611847e811ebfb3fd2b22afb805082523e9b23c25265

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page