Human readable captcha for z3cform
Project description
Introduction
============
collective.z3cform.norobots provides a "human" captcha widget based on a list of
questions/answers.
The widget is based on z3c.form.TextWidget.
Requirements
------------
* tested with Plone 3.3.2
* 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.
Credits
========
|makinacom|_
* `Planet Makina Corpus <http://www.makina-corpus.org>`_
* `Contact us <mailto:python@makina-corpus.org>`_
.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif
.. _makinacom: http://www.makina-corpus.com
Changelog
=========
1.0
----------------
* Initial release [Sylvain Boureliou]
============
collective.z3cform.norobots provides a "human" captcha widget based on a list of
questions/answers.
The widget is based on z3c.form.TextWidget.
Requirements
------------
* tested with Plone 3.3.2
* 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.
Credits
========
|makinacom|_
* `Planet Makina Corpus <http://www.makina-corpus.org>`_
* `Contact us <mailto:python@makina-corpus.org>`_
.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif
.. _makinacom: http://www.makina-corpus.com
Changelog
=========
1.0
----------------
* Initial release [Sylvain Boureliou]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for collective.z3cform.norobots-1.0.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4acecc59b9eef0376b742234dc376115ad4569edd57aacdbc5ade2a02431d25c |
|
MD5 | 6847fbfeca668bcd2ffae9967d8f11aa |
|
BLAKE2b-256 | 4e22bb88ca63be583f4006d26277e9b182ab88eb916a16de34edb83112324ab9 |