Comments (4)
Copy NoCaptchaServiceProvider.php to your app/Providers and make some changes
<?php namespace App\Providers;
use Anhskohbo\NoCaptcha\NoCaptcha;
use Illuminate\Support\ServiceProvider;
class NoCaptchaServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$app = $this->app;
$this->bootConfig();
$app['validator']->extend('captcha', function($attribute, $value) use ($app)
{
return $app['captcha']->verifyResponse($value, $app['request']->getClientIp());
});
if ($app->bound('form'))
{
$app['form']->macro('captcha', function($attributes = []) use ($app)
{
return $app['captcha']->display($attributes, $app->getLocale());
});
}
}
/**
* //
*
* @return void
*/
protected function bootConfig()
{
$path = __DIR__.'/../../vendor/anhskohbo/no-captcha/src/config/captcha.php';
$this->mergeConfigFrom($path, 'captcha');
// here all the problems... lumen does not have config_path() method
$this->publishes([$path => storage_path('captcha')]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('captcha', function($app)
{
return new NoCaptcha(
$app['config']['captcha.secret'],
$app['config']['captcha.sitekey']
);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['captcha'];
}
}
than add
$app->register('App\Providers\NoCaptchaServiceProvider');
and don't forget to turn on cookies/sessions middlewares
from no-captcha.
Done
e372cff
from no-captcha.
And thanks @hotrush
from no-captcha.
@anhskohbo 👍 good job
from no-captcha.
Related Issues (20)
- not working with Laravel 8* HOT 3
- Recaptcha Spins and then returns Uncaught (in promise) Timeout (f) HOT 4
- Validate not correct / strange message on Lumen
- ERROR for site owner: Invalid site key HOT 3
- Multiple rendering in same page
- PHP 8 HOT 1
- Missing required parameters: sitekey HOT 3
- how to use this package with laravel fortify HOT 1
- Laravel 9 and PHP8 Support HOT 2
- Where do I put the translations for "I'm not a robot"? HOT 1
- Can not make the Captcha a required field
- Can I use this plugin with hCaptcha ?
- Size problem in responsive (with picture explain)
- Livewire support HOT 2
- laravel 10 HOT 8
- cookie problem laravel 9
- How to use this package with laravel splade?
- reCAPTCHA v.3.0? HOT 1
- Add laravel 11 support HOT 1
- How to work with the laravel-jsvalidation package?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from no-captcha.