Last change
on this file since 1860 was
1860,
checked in by liebster, 14 years ago
|
Added captcha in registation form by plone4
|
File size:
828 bytes
|
Rev | Line | |
---|
[1860] | 1 | from zope.interface import Interface |
---|
| 2 | from zope.formlib import form |
---|
| 3 | |
---|
| 4 | from plone.app.users.browser.register import RegistrationForm |
---|
| 5 | |
---|
| 6 | from quintagroup.plonecaptchas.browser.field import Captcha |
---|
| 7 | from quintagroup.plonecaptchas import ProductMessageFactory as _ |
---|
| 8 | |
---|
| 9 | class ICaptchaSchema(Interface): |
---|
| 10 | captcha = Captcha( |
---|
| 11 | title=_(u'enter_word', |
---|
| 12 | default=u'Enter the word below'), |
---|
| 13 | description=_(u'label_help_captchas', |
---|
| 14 | default=u"Enter the word below for registration. ")) |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | class CustomRegistrationForm(RegistrationForm): |
---|
| 18 | """ For default registration form added captcha field. |
---|
| 19 | """ |
---|
| 20 | |
---|
| 21 | @property |
---|
| 22 | def form_fields(self): |
---|
| 23 | defaultFields = super(CustomRegistrationForm, self).form_fields |
---|
| 24 | defaultFields += form.Fields(ICaptchaSchema) |
---|
| 25 | return defaultFields |
---|
Note: See
TracBrowser
for help on using the repository browser.