[1960] | 1 | Introduction |
---|
| 2 | ============ |
---|
| 3 | |
---|
[2126] | 4 | quintagroup.z3cform.captcha is a package that allows to add captcha to the z3c.form. |
---|
| 5 | As a result such forms are prevented from automatic submit. |
---|
[1960] | 6 | |
---|
[2232] | 7 | Captchas in a z3c form |
---|
| 8 | ---------------------- |
---|
| 9 | |
---|
| 10 | Using quintagroup.z3cform.captcha in a z3c.form form is simple. |
---|
| 11 | Just add a Captcha field to your schema, use CaptchaWidgetFactory |
---|
| 12 | widget factory for this field and away you go: |
---|
| 13 | |
---|
| 14 | >>> from zope.interface import Interface |
---|
| 15 | >>> from z3c.form import form, field |
---|
| 16 | >>> from quintagroup.z3cform.captcha import Captcha |
---|
| 17 | >>> from quintagroup.z3cform.captcha import CaptchaWidgetFactory |
---|
| 18 | |
---|
| 19 | Now define form schema with Captch field |
---|
| 20 | |
---|
| 21 | >>> class ICaptchaSchema(Interface): |
---|
| 22 | ... captcha = Captcha( |
---|
| 23 | ... title=_(u'Type the code'), |
---|
| 24 | ... description=_(u'Type the code from the picture shown below.')) |
---|
| 25 | |
---|
| 26 | And set proper widget factory for the captcha field |
---|
| 27 | |
---|
| 28 | >>> class CaptchaForm(form.Form): |
---|
| 29 | ... fields = field.Fields(ICaptchaSchema) |
---|
| 30 | ... fields['captcha'].widgetFactory = CaptchaWidgetFactory |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | and z3c.form will take care of the rest. The widget associated with this field |
---|
| 34 | will render the captcha and verify the use input automatically. |
---|
| 35 | |
---|
[2126] | 36 | Supported Plone versions |
---|
| 37 | ------------------------ |
---|
| 38 | |
---|
| 39 | quintagroup.z3cform.captcha was tested with Plone 3.0.6, 3.1.7, 3.2.3, 3.3.4. |
---|
| 40 | |
---|
| 41 | Authors |
---|
| 42 | ------- |
---|
| 43 | |
---|
[2218] | 44 | * Taras Melnychuk |
---|
[2126] | 45 | * Andriy Mylenkyi |
---|
| 46 | * Vitaliy Stepanov |
---|
| 47 | |
---|
| 48 | Copyright (c) "Quintagroup": http://quintagroup.com, 2004-2010 |
---|