承接 huubl/g-recaptcha 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

huubl/g-recaptcha

Composer 安装命令:

composer require huubl/g-recaptcha

包简介

Provides a form field which allows form to validate for non-bot submissions by giving them a challenge to decrypt an image.

README 文档

README

Build Status

This module is no longer supported. Please use UndefinedOffset/silverstripe-nocaptcha instead

Introduction

Provides a FormField which allows form to validate for non-bot submissions using Google's reCAPTCHA v2 service.

In order to use Google's new Invisible reCAPTCHA service, please use the undefinedoffset/silverstripe-nocaptcha module. This module is not intended to be used with reCAPTCHA v3 (see rationale)

Requirements

  • SilverStripe Framework 4.0 or newer
  • curl PHP module
  • Requires spamprotection module

Installation

  • Copy the recaptcha directory into your main SilverStripe webroot
  • Run ?flush=1

This should go in your mysite/_config/recaptcha.yml. You can get an free API key at https://www.google.com/recaptcha

SilverStripe\Recaptcha\RecaptchaField:
  public_api_key: "your-site-key"
  private_api_key: "your-secret-key"

If using on a site requiring a proxy server for outgoing traffic then you can set these additional options in your mysite/_config/recaptcha.yml by adding.

  proxy_server: "proxy_address"
  proxy_auth: "username:password"

To use the noscript fallback method, add the key noscript_enabled: true to your yml.

To change the language, add it to an array of options to your yml

  options: 
    hl: NL
    theme: dark
    type: audio
    size: compact

See https://developers.google.com/recaptcha/docs/display#render_param for all available parameters

Usage

As a Standalone Field

If you want to use reCAPTCHA field by itself, you can simply just include it as a field in your form.

$recaptchaField = new RecaptchaField('MyCaptcha');
$recaptchaField->options = array('theme' => 'light'); // optional

See reCAPTCHA docs for more configuration options.

Integration with spamprotection module

This requires the spamprotection module to be installed, see its documentation for details. You can use this field to protect any built informs on your website, including user comments in the [[:modules:blog]] module.

Configuration example in mysite/_config/spamprotection.yml

---
name: spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector

Then once you have setup this config you will need to include the spam protector field as per the instructions on the spamprotection page.

Known issues:

Problems with page doctype XHTML

reCAPTCHA current does not work if the page doctype is XHTML. The API returns Javascript which uses "document.write", which is not supported in XHTML. A work-around is to always use the no-script version of the module (modify the relevant lines in RecaptchaField.php), or to switch your webpage's doctype to HTML 4. See: http://www.w3schools.com/tags/tag_DOCTYPE.asp

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-11-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固