Captcha plugin support for collective.z3cform.norobots added.
svn path=/plone.app.discussion/trunk/; revision=39848
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user