ruslanka1987 / invisible-recaptcha
Invisible reCAPTCHA For Laravel.
Installs: 40
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 162
pkg:composer/ruslanka1987/invisible-recaptcha
Requires
- php: ^5.6.4 || ^7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^5.0
Requires (Dev)
- illuminate/view: ^5.0
- phpunit/phpunit: ^6.1|^7.0
README
Notice
- This branch is for multi-forms purpose.
- In most of cases, there should be only one captcha in your page. You should use master branch normally.
- Do not use multiple captchas in one page for protecting every form far from bots, it will cause terrible user experience.
Installation
composer require albertcht/invisible-recaptcha:dev-multi-forms
Usage Example
// you must include `jquery` beforehand <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> {!! Form::open(['url' => '/', 'id' => 'form1']) !!} @captcha() {!! Form::submit('Sumbit', ['id'=>'s1']) !!} {!! Form::close() !!} {!! Form::open(['url' => '/']) !!} @captcha() {!! Form::submit('Sumbit2', ['id'=>'s2']) !!} {!! Form::close() !!}
Please include jquery.js manually before you calling the captcha.
Just call captcha function in forms directly, it will render only one captcha and all the forms will share the same captcha validation.
<script type="text/javascript"> $('#s2').on('captcha', function(e) { // set it to false if you don't want to submit your from directly _submitAction = false; // do other stuff }); </script>
In this branch, you can cutomize your submit behavior by listening a captcha event.
Example Repository
Repo: https://github.com/albertcht/invisible-recaptcha-example/tree/multi-forms
This repo demonstrates how to use this package with ajax way.
Diffs
- There's no
INVISIBLE_RECAPTCHA_DEBUGconfig in this branch. - This package rely on
jqueryinstead ofpilyfill.js, and you have to includejqueryby yourself before you call the captcha.