创建您自己的 plone.app.discussion 验证码
我想为 plone.app.discussion 创建一个具有文化背景的静态验证码:来自某个国家的人可能会理解问题并知道答案。
plone.app.discussion 文档页面讨论了有关验证码架构的
http://packages.python。 org/plone.app.discussion/captcha.html
但是,它没有提供运行您自己的验证码所需执行的步骤或涉及哪些适配器等以及如何注册它。它提到
<meta:provides feature="plone.app.discussion-captcha" />
......但没有给出任何提示这应该做什么。
I'd like to create a static captcha for plone.app.discussion with cultural context: people from a certain nation would be likely to understand the question and know the answer.
plone.app.discussion documentation page discussed about captcha architecture
http://packages.python.org/plone.app.discussion/captcha.html
However, it does not provide steps what you need to do to get your own captcha running or what adapters etc. are involved and how to register it. It mentions
<meta:provides feature="plone.app.discussion-captcha" />
... but does not give any hint what this should do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以使用自定义验证码字段和验证器来扩展评论表单。请参阅 http://packages.python.org/plone.app.discussion/ howtos/howto_extend_the_comment_form.html 了解有关如何扩展评论表单的详细信息以及 http://svn.plone .org/svn/plone/plone.app.discussion/trunk/plone/app/discussion/browser/validator.py 了解如何编写自定义验证器。
Monkey 修补代码不是必需的。 padiscussion 中验证码特定代码的唯一原因是,大多数验证码解决方案(例如 plone.formwidget.captcha 和 plone.formwidget.recaptcha)只是通用的 plone.z3cform 字段/小部件。这些通用字段/小部件需要插入评论表单中,以使验证码字段和验证器实际工作(现在发生在 padiscussion 本身中,但这也可能发生在验证码字段包中)。
You can always extend the comment form with a custom captcha field and validator. See http://packages.python.org/plone.app.discussion/howtos/howto_extend_the_comment_form.html for details about how to extend the comment form and http://svn.plone.org/svn/plone/plone.app.discussion/trunk/plone/app/discussion/browser/validator.py for how to write a custom validator.
Monkey patching code is not necessary. The only reason for captcha specific code in p.a.discussion is, that most captcha solutions (such as plone.formwidget.captcha and plone.formwidget.recaptcha) are only generic plone.z3cform fields/widgets. These generic fields/widgets need to be plugged into the comment form to make the captcha field and validator actually work (which right now happens in p.a.discussion itself, but this could also happen in the captcha field packages).