mosaxiv/cakephp-invisible-recaptcha
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mosaxiv/cakephp-invisible-recaptcha
包简介
cakephp-invisible-recaptcha plugin for CakePHP
README 文档
README
Requirements
- CakePHP 3.4.0+
Installation
composer require mosaxiv/cakephp-invisible-recaptcha
obtain a invisible reCAPTCHA API key.
SetUp
Configure
With the following test keys, you will always get No CAPTCHA and all verification requests will pass.
Please do not use these keys for your production traffic.
Configure::write('recaptcha', [ 'sitekey' => '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI', 'secretkey' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe', ]);
loadComponent
$this->loadComponent('InvisibleReCaptcha.InvisibleReCaptcha', [ // options ]);
Some of the options available:
| Option | Description | Default | Value |
|---|---|---|---|
| secretkey | Override secret API key | null | |
| sitekey | Override site API key | null | |
| hl | Optional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified. (See language codes) | null | |
| badge | Optional. Reposition the reCAPTCHA badge.inline allows you to control the CSS. |
bottomright | bottomright bottomleft inline |
| type | Optional. The type of CAPTCHA to serve. | image | audio image |
| timeout | The number of seconds to wait for reCAPTCHA servers before give up. | 3 | integer |
| noscript | Include <noscript> content |
true | boolean |
docs https://developers.google.com/recaptcha/docs/invisible#config
Used
Display recaptcha in your view
<?php echo $this->Form->create(); echo $this->Form->control('email'); echo $this->Form->submit(); echo $this->InvisibleReCaptcha->render(); echo $this->Form->end(); ?>
Verify in your controller
if ($this->InvisibleReCaptcha->verify()) { //do something }
use ServerRequest::clientIp to get the IP address.
See https://book.cakephp.org/3.0/en/controllers/request-response.html#trusting-proxy-headers
统计信息
- 总下载量: 5.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-26