-
composer.json
Open in GitHub{ // "require": { "php": "^7.3", // "buzz/laravel-h-captcha": "1.0.2" }, // }
-
config/captcha.php
Open in GitHubreturn [ 'enabled' => env('CAPTCHA_ENABLED', false), 'secret' => env('CAPTCHA_SECRET', 'default_secret'), 'sitekey' => env('CAPTCHA_SITEKEY', 'default_sitekey'), 'http_client' => \Buzz\LaravelHCaptcha\HttpClient::class, 'options' => [ 'multiple' => false, 'lang' => app()->getLocale(), ], 'attributes' => [ 'theme' => 'light' ], ];
-
app/Http/Controllers/Auth/LoginController.php
Open in GitHubuse App\Http\Controllers\Controller; class LoginController extends Controller { // public function validateLogin($request) { $rules = [ $this->username() => 'required|email', 'password' => 'required|string|min:6', ]; if(config('captcha.enabled')) { $rules['h-captcha-response'] = 'required|captcha'; } $this->validate($request, $rules); } // }
-
resources/views/auth/login.blade.php
Open in GitHub// @if(config('captcha.enabled')) <div class="d-flex justify-content-center mb-3"> {!! Captcha::display() !!} </div> @endif //