cradlephp/cradle-captcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cradlephp/cradle-captcha

Composer 安装命令:

composer require cradlephp/cradle-captcha

包简介

Google Captcha handler for Cradle

README 文档

README

Google Captcha Helpers

Install

composer require cradlephp/cradle-captcha

Then in /bootstrap.php, add

->register('cradlephp/cradle-captcha')

Setup

Go to https://www.google.com/recaptcha/ and register for a token and secret.

Open /config/services.php and add

'captcha-main' => array(
    'token' => '<Google Token>',
    'secret' => '<Google Secret>'
),

Usage

In any of your routes add the following code.

cradle()->trigger('captcha-load', $request, $response);

The CSRF token will be found in $request->getStage('captcha'). In your form template, be sure to add this key in a hidden field like the following.

<script src="https://www.google.com/recaptcha/api.js"></script>
<div class="g-recaptcha" data-sitekey="{{captcha}}"></div>

When validating this form in a route you can use the following

cradle()->trigger('captcha-validate', $request, $response);

If there is an error, it will be found in the response error object message. You can check this using the following.

if($response->isError()) {
    $message = $response->getMessage();
    //report the error
}

统计信息

  • 总下载量: 870
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固