Captcha plugin support for collective.z3cform.norobots added.

svn path=/plone.app.discussion/trunk/; revision=39848
This commit is contained in:
Timo Stollenwerk
2010-09-10 13:02:56 +00:00
parent 2aaf74ddd3
commit 3d594a934d
5 changed files with 25 additions and 3 deletions
+3
View File
@@ -67,6 +67,9 @@ class CaptchaExtender(extensible.FormExtender):
elif self.captcha == 'recaptcha':
from plone.formwidget.recaptcha import ReCaptchaFieldWidget
self.form.fields['captcha'].widgetFactory = ReCaptchaFieldWidget
elif self.captcha == 'norobots':
from collective.z3cform.norobots import NorobotsFieldWidget
self.form.fields['captcha'].widgetFactory = NorobotsFieldWidget
else:
self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE
+1 -1
View File
@@ -44,7 +44,7 @@ class CaptchaValidator(validator.SimpleFieldValidator):
registry = queryUtility(IRegistry)
settings = registry.forInterface(IDiscussionSettings)
if settings.captcha == 'captcha' or settings.captcha == 'recaptcha':
if settings.captcha in ('captcha', 'recaptcha', 'norobots'):
captcha = getMultiAdapter((aq_inner(self.context), self.request),
name=settings.captcha)
if not captcha.verify(input=value):