Coder Social home page Coder Social logo

suchoproduction / recaptcha Goto Github PK

View Code? Open in Web Editor NEW

This project forked from contributte/recaptcha

0.0 0.0 0.0 240 KB

:bangbang: Google reCAPTCHA (security) for Nette Framework \ Forms

Home Page: https://contributte.org/packages/contributte/reCAPTCHA.html

License: MIT License

PHP 93.37% JavaScript 3.13% Makefile 3.50%

recaptcha's Introduction

reCAPTCHA

Google reCAPTCHA implementation for Nette Framework forms.


Build Status Code coverage Licence Downloads this Month Downloads total Latest stable PHPStan

Discussion / Help

Join the chat

Versions

Branch Composer Nette PHP Readme
dev ~3.4.0 3.0+ ^7.2 -
latest ~3.4.0 3.0+ ^7.2 -
3.x ~3.1.0 2.4 ^7.1 -
2.x ~2.1.0 2.4 ^5.6 README-2.x
1.6.x ~1.6.3 2.4 ^5.6 README-1.6
1.5.x ~1.5.2 2.3 ^5.4 README-1.5
1.4.x ~1.4.4 2.2 ^5.4 README-1.4
1.3.x ~1.3.0 2.1 ^5.4 README-1.3

Pre-installation

Add your site to the sitelist in reCAPTCHA administration.

reCAPTCHA

Installation

The latest version is most suitable for Nette 2.4 and PHP >=5.6.

composer require contributte/recaptcha

Configuration

extensions:
    recaptcha: Contributte\ReCaptcha\DI\ReCaptchaExtension

recaptcha:
    secretKey: ***
    siteKey: ***

Usage

use Nette\Application\UI\Form;

protected function createComponentForm()
{
    $form = new Form();

    $form->addReCaptcha('recaptcha', $label = 'Captcha')
        ->setMessage('Are you a bot?');

    $form->addReCaptcha('recaptcha', $label = 'Captcha', $required = FALSE)
        ->setMessage('Are you a bot?');

    $form->addReCaptcha('recaptcha', $label = 'Captcha', $required = TRUE, $message = 'Are you a bot?');

    $form->onSuccess[] = function($form) {
        dump($form->getValues());
    }
}

Rendering

<form n:name="myForm">
	<div class="form-group">
		<div n:name="recaptcha"></div>
	</div>
</form>

Be sure to place this script before the closing tag of the body element (</body>).

<!-- re-Captcha -->
<script src='https://www.google.com/recaptcha/api.js'></script>

Invisible

reCAPTCHA

Usage

use Nette\Application\UI\Form;

protected function createComponentForm()
{
    $form = new Form();

    $form->addInvisibleReCaptcha('recaptcha')
        ->setMessage('Are you a bot?');

    $form->addInvisibleReCaptcha('recaptcha', $required = FALSE)
        ->setMessage('Are you a bot?');

    $form->addInvisibleReCaptcha('recaptcha', $required = TRUE, $message = 'Are you a bot?');

    $form->onSuccess[] = function($form) {
        dump($form->getValues());
    }
}

Be sure to place this script before the closing tag of the body element (</body>).

Copy assets/invisibleRecaptcha.js and link it.

<script src="https://www.google.com/recaptcha/api.js?render=explicit"></script>
<script src="{$basePath}/assets/invisibleRecaptcha.js"></script>

recaptcha's People

Contributors

f3l1x avatar mabar avatar paveljurasek avatar jangalek avatar juniwalk avatar jansramek avatar adaamz avatar fvesely avatar gappa avatar natocto avatar

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.