Code Monkey home page Code Monkey logo

cakephp-invisible-recaptcha's Introduction

cakephp-invisible-recaptcha plugin for CakePHP

MIT License Build Status

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

cakephp-invisible-recaptcha's People

Contributors

mosaxiv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cakephp-invisible-recaptcha's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.