包装recaptcha-client库,为collective.captcha提供即插即用的替代方案。
项目描述
collective.recaptcha
此软件包将Google提供的第三方reCAPTCHA服务集成到Zope中。reCAPTCHA是Google提供的第三方CAPTCHA服务。
API基于collective.captcha,并通过“@@captcha”浏览器视图提供,因此这两个软件包可以相对简单地互换。如果您需要不依赖于外部服务,请使用collective.captcha;如果您希望获得更好的用户体验,请使用collective.recaptcha。
对在z3c.form表单中添加ReCAPTCHA感兴趣的Plone用户可能会对plone.formwidget.recaptcha软件包感兴趣。
升级
要将collective.recaptcha升级到2.*(reCaptcha API V2),您需要检查您的密钥,因为V2 API不支持全局密钥,因此如果您希望使用V2 API,则需要创建一个新的密钥。
安装和配置
只需确保加载此软件包的ZCML即可。(您不能在配置collective.captcha的同时配置此软件包,因为“@@captcha”浏览器视图注册将发生冲突。)
在服务开始工作之前,您必须从https://developers.google.com/recaptcha/获取公钥和私钥,并在http://path/to/site/@@recaptcha-settings中进行配置
您可以在配置文件中使用plone.app.registry提供您的配置
<registry> <records interface="collective.recaptcha.settings.IRecaptchaSettings"> <value key="public_key"></value> <value key="private_key"></value> </records> </registry>
使用方法
您可以使用以下TAL插入Recaptcha:
<tal:block tal:replace="structure context/@@captcha/image_tag"/>
您可以通过测试以下返回值来验证Recaptcha输入:
context.restrictedTraverse('@@captcha').verify()
此软件包的API与collective.captcha之间的差异
由于Recaptcha的最简单形式完全通过远程调用服务渲染,我们无法按照collective.captcha中定义的方式实现ICaptchaView接口。差异包括
* The image_tag method returns the HTML for the entire CAPTCHA widget, including text entry and audio link, not just the tag for the CAPTCHA image. * The audio_url method returns None * The verify method does not require the input parameter, as a standard form input name is used and the value can be found in the request. * There is an additional method, external, which simply returns True. This is a bit of a hack so that a template requiring captcha can adjust to the different semantics of the @@captcha view in this package as compared to collective.captcha.
测试
此附加组件使用GitHub Actions进行测试。当前附加组件的状态是
贡献者
David Glick, david@glicksoftware.com
变更日志
2.1.2 (2022-07-26)
在重新应用配置文件时保留值(修复#36)。[wesleybl]
2.1.1 (2022-07-21)
修复Plone 4模式中的recaptcha加载。[wesleybl]
在Python 3上启动(Plone 5.2)。尚未在5.2上运行测试,因此兼容性尚未确认。[maurits]
添加翻译[rodfersou]
2.1.0 (2017-12-04)
更新bootstrap
更新文档
支持Plone 5,无需拉入zope.formlib [ale-rt]
添加安装和卸载配置文件以及控制面板配置项[frapell]
2.0.0 (2016-03-06)
Google reCAPTCHA API v.2 [mamico]
1.1.5 (2014-05-07)
修复从注册表中检索配置的问题[mpeeters]
在README中对接口名称进行微小修正[frapell]
1.1.4 (2013-04-09)
添加Plone 4.3兼容性[aclark4life]
1.1.3 (2011-08-19)
添加z3c.autoinclude条目点以在Plone 3.3+中自动加载ZCML [WouterVH]
1.1.2 (2011-05-17)
需要recaptcha-client的最新版本,该版本具有recaptcha服务的正确HTTPS URL。[davisagli]
支持 Zope2.13:首先尝试使用 five.formlib。[toutpt]
1.1.1 (2011-02-15)
使用 browser:page 而不是 browser:view 注册 @@captcha 视图,因为我仍然无法理解后者,并且在 Zope 2.12 中导致受限 Python 的访问中断。[davisagli]
1.1 (2010-11-18)
如果已安装,则使用 plone.formwidget.recaptcha 的 recaptcha 设置,因为它会覆盖我们的 recaptcha-settings 视图。[davisagli]
1.0.1 (2009-08-05)
不允许依赖于已损坏的 recaptcha-client 发布版本(1.0.4)。[davisagli]
1.0 (2009-05-04)
修复了 verify 方法的签名,以便不再需要来自 collective.captcha 的 ICaptchaView 的遗留输入参数。[davisagli]
添加了文档。[davisagli]
1.0b2(2009-01-14)
正确处理 HTTP_X_FORWARDED_FOR 标头中的逗号分隔值。[davisagli]
添加了在相同请求中多次验证 captcha 的支持。[davisagli]
在视图方法上添加了安全声明,以便可以从受限 Python 中调用它们。[davisagli]
1.0b1(2009-01-14)
初始发布
项目详情
collective.recaptcha-2.1.2.tar.gz 的散列
算法 | 散列摘要 | |
---|---|---|
SHA256 | 45b1b9f79c5653c35390089aab7e8c0abc7e0e132a13861d7648f075f95b768b |
|
MD5 | 05041176a2ce90cda9ced9c425545cd4 |
|
BLAKE2b-256 | 29b8e6a330f8788262f061ed3a44f9936f13f9ebdceb59264a6ed72fdf99cf6c |