Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 64e7e99

Browse files
committed
Merge branch 'feature/bugfix-route-cache' into develop
2 parents bafd090 + 454d11f commit 64e7e99

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2017 - present
4+
* LaravelGoogleRecaptcha - ReCaptchaController.php
5+
* author: Roberto Belotti - [email protected]
6+
* web : robertobelotti.com, github.com/biscolab
7+
* Initial version created on: 4/2/2019
8+
* MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
9+
*/
10+
11+
namespace Biscolab\ReCaptcha\Controllers;
12+
13+
use Illuminate\Routing\Controller;
14+
15+
/**
16+
* Class ReCaptchaController
17+
* @package Biscolab\ReCaptcha\Controllers
18+
*/
19+
class ReCaptchaController extends Controller {
20+
21+
/**
22+
* @return array
23+
*/
24+
public function validateV3(): array {
25+
26+
$token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
27+
return recaptcha()->validate($token);
28+
}
29+
}

src/ReCaptchaBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function htmlScriptTagJsApiV3(?array $configuration = []): string {
216216
*
217217
* @param string $response
218218
*
219-
* @return boolean
219+
* @return boolean|array
220220
*/
221221
public function validate($response) {
222222

src/routes/routes.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
* MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
99
*/
1010

11-
Route::get(config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'), function () {
12-
13-
$token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), '');
14-
$validation_response = recaptcha()->validate($token);
15-
16-
return response()->json($validation_response);
17-
})->middleware('web');
11+
Route::get(
12+
config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'),
13+
['uses' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3']
14+
)->middleware('web');

0 commit comments

Comments
 (0)