thoughtfully / module-recaptcha
此包最新版本(0.0.2)没有可用的许可证信息。
Magento 2 的 Google Recaptcha 集成
由于主仓库似乎已删除,因此该包已被冻结。
0.0.2
2018-07-02 19:21 UTC
This package is auto-updated.
Last update: 2021-02-23 05:22:00 UTC
README
本模块将 Google Recaptcha 集成到 Magento 2 表单中。
安装
使用 composer 安装模块。
composer require thoughtfully/module-recaptcha
升级并重新编译 Magento
php bin/magento setup:upgrade
php bin/magento setup:di:compile
配置
通过登录 Magento 2 管理面板并导航到可以找到模块配置
Stores > Settings > Configuration > Thoughtfully > Recaptcha
常规
- 启用
- 启用或禁用 Google Recaptcha 验证
- API URL
- Google Recaptcha API 的 API URL 端点
- 站点密钥
- 在 Recaptcha Admin 中设置 Google Recaptcha 密钥对时提供的站点密钥。
- 密钥
- 在 Recaptcha Admin 中设置 Google Recaptcha 密钥对时提供的密钥。
要验证的表单
- 联系表单
- 位于 https://example.com/contact 的 Magento 2 原生联系表单
- 注册表单
- 位于 https://example.com/customer/account/create 的 Magento 2 原生客户注册表单
验证其他表单
使用以下信息在自己的表单中实现 Google Recaptcha
- 在您的
<form/>
中渲染模块的recaptcha.captcha
块(在view/frontend/layout/default.xml
中定义)。
<?php echo $block->getLayout()->renderElement('recaptcha.captcha') ?>
- 在控制器中验证 captcha。
- 抽象类文件
Plugin/AbstractPlugin.php
定义了validateRecaptcha()
方法,用于验证用户的 captcha 输入。 - 您可以使用 Plugin (Interceptor) 在表单提交到 Magento 控制器端点之前验证 captcha。请参阅
Plugin/Controller/ContactFormPlugin.php
以获取示例。
- 抽象类文件
问题/增强功能
请随时使用 仓库的问题板请求功能/报告问题/提供反馈。