From 8ecdcd6bf12940a8dcc065091a7615ac9aab9dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Janou=C5=A1ek?= Date: Mon, 18 Jan 2021 15:43:49 +0100 Subject: [PATCH] laravel 8 --- .travis.yml | 2 +- README.md | 112 +--------------------- composer.json | 22 ++--- src/Facades/InvisibleReCaptcha.php | 2 +- src/InvisibleReCaptcha.php | 2 +- src/InvisibleReCaptchaServiceProvider.php | 2 +- tests/CaptchaTest.php | 4 +- 7 files changed, 21 insertions(+), 125 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5f6b0a..6fbb91e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: php php: - - '7.2' - '7.3' + - '7.4' install: - travis_retry composer install --no-interaction --prefer-dist --no-suggest diff --git a/README.md b/README.md index d16fa76..4064ddb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,5 @@ Invisible reCAPTCHA ========== -![php-badge](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg) -[![packagist-badge](https://img.shields.io/packagist/v/albertcht/invisible-recaptcha.svg)](https://packagist.org/packages/albertcht/invisible-recaptcha) -[![Total Downloads](https://poser.pugx.org/albertcht/invisible-recaptcha/downloads)](https://packagist.org/packages/albertcht/invisible-recaptcha) -[![travis-badge](https://api.travis-ci.org/albertcht/invisible-recaptcha.svg?branch=master)](https://travis-ci.org/albertcht/invisible-recaptcha) - ![invisible_recaptcha_demo](http://i.imgur.com/1dZ9XKn.png) ## Why Invisible reCAPTCHA? @@ -19,20 +14,10 @@ In reCAPTCHA v2, users need to click the button: "I'm not a robot" to prove they ## Installation ``` -composer require albertcht/invisible-recaptcha +composer require ami-praha/invisible-recaptcha ``` -## Laravel 5 - -### Setup - -Add ServiceProvider to the providers array in `app/config/app.php`. - -``` -AlbertCht\InvisibleReCaptcha\InvisibleReCaptchaServiceProvider::class, -``` - -> It also supports package discovery for Laravel 5.5. +## Laravel 8 ### Configuration Before you set your config, remember to choose `invisible reCAPTCHA` while applying for keys. @@ -128,81 +113,6 @@ $validate = Validator::make(Input::all(), [ ``` -## CodeIgniter 3.x - -set in application/config/config.php : -```php -$config['composer_autoload'] = TRUE; -``` - -add lines in application/config/config.php : -```php -$config['recaptcha.sitekey'] = 'sitekey'; -$config['recaptcha.secret'] = 'secretkey'; -// optional -$config['recaptcha.options'] = [ - 'hideBadge' => false, - 'dataBadge' => 'bottomright', - 'timeout' => 5, - 'debug' => false -]; -``` - -In controller, use: -```php -$data['captcha'] = new \AlbertCht\InvisibleReCaptcha\InvisibleReCaptcha( - $this->config->item('recaptcha.sitekey'), - $this->config->item('recaptcha.secret'), - $this->config->item('recaptcha.options'), -); -``` - -In view, in your form: -```php -render(); ?> -``` - -Then back in your controller you can verify it: -```php -$captcha->verifyResponse($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); -``` - -## Without Laravel or CodeIgniter - -Checkout example below: - -```php - false, - 'dataBadge' => 'bottomright', - 'timeout' => 5, - 'debug' => false -]; -$captcha = new \AlbertCht\InvisibleReCaptcha\InvisibleReCaptcha($siteKey, $secretKey, $options); - -// you can override single option config like this -$captcha->setOption('debug', true); - -if (!empty($_POST)) { - var_dump($captcha->verifyResponse($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR'])); - exit(); -} - -?> - -
- render(); ?> - -
-``` - ## Take Control of Submit Function Use this function only when you need to take all control after clicking submit button. Recaptcha validation will not be triggered if you return false in this function. @@ -252,20 +162,6 @@ _submitEvent = function() { }; ``` ## Example Repository -Repo: https://github.com/albertcht/invisible-recaptcha-example - -This repo demonstrates how to use this package with ajax way. - -## Showcases - -* [Laravel Boilerplate](https://github.com/Labs64/laravel-boilerplate) - -## Credits - -* anhskohbo (the author of no-captcha package) -* [Contributors](https://github.com/albertcht/invisible-recaptcha/graphs/contributors) - -## Support on Beerpay -Hey dude! Help me out for a couple of :beers:! +Repo: https://github.com/ami-praha/invisible-recaptcha-example -[![Beerpay](https://beerpay.io/albertcht/invisible-recaptcha/badge.svg?style=beer-square)](https://beerpay.io/albertcht/invisible-recaptcha) [![Beerpay](https://beerpay.io/albertcht/invisible-recaptcha/make-wish.svg?style=flat-square)](https://beerpay.io/albertcht/invisible-recaptcha?focus=wish) +This repo demonstrates how to use this package with ajax way. \ No newline at end of file diff --git a/composer.json b/composer.json index ff9e732..7a6ae03 100644 --- a/composer.json +++ b/composer.json @@ -1,32 +1,32 @@ { - "name": "albertcht/invisible-recaptcha", + "name": "ami-praha/invisible-recaptcha", "description": "Invisible reCAPTCHA For Laravel.", - "keywords": ["recaptcha", "no-captcha", "captcha", "invisible", "invisible-recaptcha", "laravel", "laravel5", "php"], + "keywords": ["recaptcha", "no-captcha", "captcha", "invisible", "invisible-recaptcha", "laravel", "php"], "license": "MIT", "authors": [ { - "name": "Albert Chen", - "homepage": "https://www.albert-chen.com" + "name": "AMI Praha a.s.", + "homepage": "https://www.ami.cz" } ], "require": { - "php": "^5.6.4 || ^7.0", - "illuminate/support": "^5.0|^6.0|^7.0", - "guzzlehttp/guzzle": "^6.2" + "php": ">=7.3", + "illuminate/support": "^8.0", + "guzzlehttp/guzzle": "^7.0.1" }, "require-dev": { - "phpunit/phpunit": "^8.0", - "illuminate/view": "^5.0|^6.0|^7.0" + "phpunit/phpunit": "^9.0", + "illuminate/view": "^8.0" }, "autoload": { "psr-4": { - "AlbertCht\\InvisibleReCaptcha\\": "src/" + "AmiPraha\\InvisibleReCaptcha\\": "src/" } }, "extra": { "laravel": { "providers": [ - "AlbertCht\\InvisibleReCaptcha\\InvisibleReCaptchaServiceProvider" + "AmiPraha\\InvisibleReCaptcha\\InvisibleReCaptchaServiceProvider" ] } } diff --git a/src/Facades/InvisibleReCaptcha.php b/src/Facades/InvisibleReCaptcha.php index c6c1808..4e3e2d0 100644 --- a/src/Facades/InvisibleReCaptcha.php +++ b/src/Facades/InvisibleReCaptcha.php @@ -1,6 +1,6 @@