You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Amir Reza Mehrbakhsh 551ffb41b5 Update README.md 5 years ago
src Update README.md 5 years ago
.gitignore Recaptcha facade 5 years ago
README.md Update README.md 5 years ago
composer.json Recaptcha facade 5 years ago

README.md

recaptcha-package

the Public repo of the reCaptcha project.

Installation

Require the package:

$ composer require dakyaco/ketabuzz

Add these lines to config/services.php

'recaptcha' => [
    'url' => env('RECAPTCHA_URL'),
    'secret' => env('RECAPTCHA_SECRET'),
]

Now go to .env file and set your credentials

RECAPTCHA_URL=
RECAPTCHA_SECRET=your-secret-key

How to use

Go to app/Http/Controllers/LoginController.php and add following code

(you can handle it whatever you want. It's just an option)

use Dakyaco\Recaptcha\Facade\Recaptcha;

use AuthenticatesUsers {
    validateLogin as validateCredentials;
}

// ....

protected function validateLogin(Request $request)
{
    $result = Recaptcha::verify($request);
    if($result['valid']) {
        $this->validateCredentials($request);
    } else {
        throw ValidationException::withMessages([
            'recaptcha' => 'کپچا صحیح نمی باشد',
        ]);
    }
}