@@ -20,29 +20,29 @@ |
||
20 | 20 | */ |
21 | 21 | class TestCase extends OrchestraTestCase { |
22 | 22 | |
23 | - /** |
|
24 | - * Load package alias |
|
25 | - * |
|
26 | - * @param \Illuminate\Foundation\Application $app |
|
27 | - * |
|
28 | - * @return array |
|
29 | - */ |
|
30 | - protected function getPackageAliases($app) { |
|
23 | + /** |
|
24 | + * Load package alias |
|
25 | + * |
|
26 | + * @param \Illuminate\Foundation\Application $app |
|
27 | + * |
|
28 | + * @return array |
|
29 | + */ |
|
30 | + protected function getPackageAliases($app) { |
|
31 | 31 | |
32 | - return [ |
|
33 | - 'ReCaptcha' => ReCaptcha::class, |
|
34 | - ]; |
|
35 | - } |
|
32 | + return [ |
|
33 | + 'ReCaptcha' => ReCaptcha::class, |
|
34 | + ]; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Load package service provider |
|
39 | - * |
|
40 | - * @param \Illuminate\Foundation\Application $app |
|
41 | - * |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - protected function getPackageProviders($app) { |
|
37 | + /** |
|
38 | + * Load package service provider |
|
39 | + * |
|
40 | + * @param \Illuminate\Foundation\Application $app |
|
41 | + * |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + protected function getPackageProviders($app) { |
|
45 | 45 | |
46 | - return [ReCaptchaServiceProvider::class]; |
|
47 | - } |
|
46 | + return [ReCaptchaServiceProvider::class]; |
|
47 | + } |
|
48 | 48 | } |
@@ -18,13 +18,13 @@ |
||
18 | 18 | */ |
19 | 19 | class ReCaptcha extends Facade { |
20 | 20 | |
21 | - /** |
|
22 | - * Get the registered name of the component. |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - protected static function getFacadeAccessor() { |
|
21 | + /** |
|
22 | + * Get the registered name of the component. |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + protected static function getFacadeAccessor() { |
|
27 | 27 | |
28 | - return 'recaptcha'; |
|
29 | - } |
|
28 | + return 'recaptcha'; |
|
29 | + } |
|
30 | 30 | } |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | use Biscolab\ReCaptcha\Facades\ReCaptcha; |
12 | 12 | |
13 | 13 | if (!function_exists('recaptcha')) { |
14 | - /** |
|
15 | - * @return Biscolab\ReCaptcha\ReCaptchaBuilder |
|
16 | - */ |
|
17 | - function recaptcha() { |
|
14 | + /** |
|
15 | + * @return Biscolab\ReCaptcha\ReCaptchaBuilder |
|
16 | + */ |
|
17 | + function recaptcha() { |
|
18 | 18 | |
19 | - return app('recaptcha'); |
|
20 | - } |
|
19 | + return app('recaptcha'); |
|
20 | + } |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | */ |
30 | 30 | if (!function_exists('htmlScriptTagJsApi')) { |
31 | 31 | |
32 | - /** |
|
33 | - * @param string $formId |
|
34 | - * |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - function htmlScriptTagJsApi($formId = ''): string { |
|
32 | + /** |
|
33 | + * @param string $formId |
|
34 | + * |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + function htmlScriptTagJsApi($formId = ''): string { |
|
38 | 38 | |
39 | - return ReCaptcha::htmlScriptTagJsApi($formId); |
|
40 | - } |
|
39 | + return ReCaptcha::htmlScriptTagJsApi($formId); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | */ |
50 | 50 | if (!function_exists('htmlScriptTagJsApiV3')) { |
51 | 51 | |
52 | - /** |
|
53 | - * @param array $config |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - function htmlScriptTagJsApiV3($config = []): string { |
|
52 | + /** |
|
53 | + * @param array $config |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + function htmlScriptTagJsApiV3($config = []): string { |
|
58 | 58 | |
59 | - return ReCaptcha::htmlScriptTagJsApiV3($config); |
|
60 | - } |
|
59 | + return ReCaptcha::htmlScriptTagJsApiV3($config); |
|
60 | + } |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | */ |
72 | 72 | if (!function_exists('htmlFormButton')) { |
73 | 73 | |
74 | - /** |
|
75 | - * @param null|string $buttonInnerHTML |
|
76 | - * |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string { |
|
74 | + /** |
|
75 | + * @param null|string $buttonInnerHTML |
|
76 | + * |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + function htmlFormButton(?string $buttonInnerHTML = 'Submit'): string { |
|
80 | 80 | |
81 | - return ReCaptcha::htmlFormButton($buttonInnerHTML); |
|
82 | - } |
|
81 | + return ReCaptcha::htmlFormButton($buttonInnerHTML); |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | if (!function_exists('htmlFormSnippet')) { |
93 | 93 | |
94 | - /** |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - function htmlFormSnippet(): string { |
|
94 | + /** |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + function htmlFormSnippet(): string { |
|
98 | 98 | |
99 | - return ReCaptcha::htmlFormSnippet(); |
|
100 | - } |
|
99 | + return ReCaptcha::htmlFormSnippet(); |
|
100 | + } |
|
101 | 101 | } |
102 | 102 |
@@ -18,12 +18,12 @@ |
||
18 | 18 | */ |
19 | 19 | class ReCaptchaController extends Controller { |
20 | 20 | |
21 | - /** |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function validateV3(): array { |
|
21 | + /** |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function validateV3(): array { |
|
25 | 25 | |
26 | - $token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), ''); |
|
27 | - return recaptcha()->validate($token); |
|
28 | - } |
|
26 | + $token = request()->input(config('recaptcha.default_token_parameter_name', 'token'), ''); |
|
27 | + return recaptcha()->validate($token); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -22,47 +22,47 @@ |
||
22 | 22 | */ |
23 | 23 | class ReCaptchaConfigurationTest extends TestCase { |
24 | 24 | |
25 | - /** |
|
26 | - * @var ReCaptchaBuilder |
|
27 | - */ |
|
28 | - protected $recaptcha; |
|
25 | + /** |
|
26 | + * @var ReCaptchaBuilder |
|
27 | + */ |
|
28 | + protected $recaptcha; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @test |
|
32 | - */ |
|
33 | - public function testSkipIpWhiteListIsArray() { |
|
30 | + /** |
|
31 | + * @test |
|
32 | + */ |
|
33 | + public function testSkipIpWhiteListIsArray() { |
|
34 | 34 | |
35 | - $ip_whitelist = $this->recaptcha->getIpWhitelist(); |
|
36 | - $this->assertTrue(is_array($ip_whitelist)); |
|
37 | - $this->assertCount(2, $ip_whitelist); |
|
38 | - } |
|
35 | + $ip_whitelist = $this->recaptcha->getIpWhitelist(); |
|
36 | + $this->assertTrue(is_array($ip_whitelist)); |
|
37 | + $this->assertCount(2, $ip_whitelist); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @test |
|
42 | - */ |
|
43 | - public function testCurlTimeoutIsSet() { |
|
44 | - $this->assertEquals($this->recaptcha->getCurlTimeout(), 3); |
|
45 | - } |
|
40 | + /** |
|
41 | + * @test |
|
42 | + */ |
|
43 | + public function testCurlTimeoutIsSet() { |
|
44 | + $this->assertEquals($this->recaptcha->getCurlTimeout(), 3); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Define environment setup. |
|
49 | - * |
|
50 | - * @param \Illuminate\Foundation\Application $app |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - protected function getEnvironmentSetUp($app) { |
|
47 | + /** |
|
48 | + * Define environment setup. |
|
49 | + * |
|
50 | + * @param \Illuminate\Foundation\Application $app |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + protected function getEnvironmentSetUp($app) { |
|
55 | 55 | |
56 | - $app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2'); |
|
57 | - } |
|
56 | + $app['config']->set('recaptcha.skip_ip', '10.0.0.1,10.0.0.2'); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Setup the test environment. |
|
61 | - */ |
|
62 | - protected function setUp(): void { |
|
59 | + /** |
|
60 | + * Setup the test environment. |
|
61 | + */ |
|
62 | + protected function setUp(): void { |
|
63 | 63 | |
64 | - parent::setUp(); // TODO: Change the autogenerated stub |
|
64 | + parent::setUp(); // TODO: Change the autogenerated stub |
|
65 | 65 | |
66 | - $this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key', 3); |
|
67 | - } |
|
66 | + $this->recaptcha = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key', 3); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | \ No newline at end of file |
@@ -20,73 +20,73 @@ |
||
20 | 20 | */ |
21 | 21 | class ReCaptchaTest extends TestCase { |
22 | 22 | |
23 | - protected $recaptcha_invisible = null; |
|
23 | + protected $recaptcha_invisible = null; |
|
24 | 24 | |
25 | - protected $recaptcha_v2 = null; |
|
25 | + protected $recaptcha_v2 = null; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @tests |
|
29 | - */ |
|
30 | - public function testHtmlScriptTagJsApiGetHtmlScriptTag() { |
|
27 | + /** |
|
28 | + * @tests |
|
29 | + */ |
|
30 | + public function testHtmlScriptTagJsApiGetHtmlScriptTag() { |
|
31 | 31 | |
32 | - $r = ReCaptcha::htmlScriptTagJsApi(); |
|
33 | - $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r); |
|
34 | - } |
|
32 | + $r = ReCaptcha::htmlScriptTagJsApi(); |
|
33 | + $this->assertEquals('<script src="https://www.google.com/recaptcha/api.js" async defer></script>', $r); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @test |
|
38 | - */ |
|
39 | - public function testReCaptchaInvisibleHtmlFormButtonDefault() { |
|
36 | + /** |
|
37 | + * @test |
|
38 | + */ |
|
39 | + public function testReCaptchaInvisibleHtmlFormButtonDefault() { |
|
40 | 40 | |
41 | - $recaptcha = $this->recaptcha_invisible; |
|
42 | - $html_button = $recaptcha->htmlFormButton(); |
|
43 | - $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>', $html_button); |
|
44 | - } |
|
41 | + $recaptcha = $this->recaptcha_invisible; |
|
42 | + $html_button = $recaptcha->htmlFormButton(); |
|
43 | + $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Submit</button>', $html_button); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @test |
|
48 | - */ |
|
49 | - public function testReCaptchaInvisibleHtmlFormButtonCustom() { |
|
46 | + /** |
|
47 | + * @test |
|
48 | + */ |
|
49 | + public function testReCaptchaInvisibleHtmlFormButtonCustom() { |
|
50 | 50 | |
51 | - $recaptcha = $this->recaptcha_invisible; |
|
52 | - $html_button = $recaptcha->htmlFormButton('Custom Text'); |
|
53 | - $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>', $html_button); |
|
54 | - } |
|
51 | + $recaptcha = $this->recaptcha_invisible; |
|
52 | + $html_button = $recaptcha->htmlFormButton('Custom Text'); |
|
53 | + $this->assertEquals('<button class="g-recaptcha" data-sitekey="api_site_key" data-callback="biscolabLaravelReCaptcha">Custom Text</button>', $html_button); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @test |
|
58 | - */ |
|
59 | - public function testReCaptchaV2HtmlFormSnippet() { |
|
56 | + /** |
|
57 | + * @test |
|
58 | + */ |
|
59 | + public function testReCaptchaV2HtmlFormSnippet() { |
|
60 | 60 | |
61 | - $recaptcha = $this->recaptcha_v2; |
|
62 | - $html_snippet = $recaptcha->htmlFormSnippet(); |
|
63 | - $this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet); |
|
64 | - } |
|
61 | + $recaptcha = $this->recaptcha_v2; |
|
62 | + $html_snippet = $recaptcha->htmlFormSnippet(); |
|
63 | + $this->assertEquals('<div class="g-recaptcha" data-sitekey="api_site_key"></div>', $html_snippet); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @test |
|
68 | - * @expectedException \Error |
|
69 | - */ |
|
70 | - public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() { |
|
66 | + /** |
|
67 | + * @test |
|
68 | + * @expectedException \Error |
|
69 | + */ |
|
70 | + public function testReCaptchaInvisibleHtmlFormSnippetShouldThrowError() { |
|
71 | 71 | |
72 | - $this->recaptcha_invisible->htmlFormSnippet(); |
|
73 | - } |
|
72 | + $this->recaptcha_invisible->htmlFormSnippet(); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @test |
|
77 | - * @expectedException \Error |
|
78 | - */ |
|
79 | - public function testReCaptchaV2htmlFormButtonShouldThrowError() { |
|
75 | + /** |
|
76 | + * @test |
|
77 | + * @expectedException \Error |
|
78 | + */ |
|
79 | + public function testReCaptchaV2htmlFormButtonShouldThrowError() { |
|
80 | 80 | |
81 | - $this->recaptcha_v2->htmlFormButton(); |
|
82 | - } |
|
81 | + $this->recaptcha_v2->htmlFormButton(); |
|
82 | + } |
|
83 | 83 | |
84 | - protected function setUp(): void { |
|
84 | + protected function setUp(): void { |
|
85 | 85 | |
86 | - parent::setUp(); // TODO: Change the autogenerated stub |
|
86 | + parent::setUp(); // TODO: Change the autogenerated stub |
|
87 | 87 | |
88 | - $this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key', 3); |
|
89 | - $this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key', 3); |
|
88 | + $this->recaptcha_invisible = new ReCaptchaBuilderInvisible('api_site_key', 'api_secret_key', 3); |
|
89 | + $this->recaptcha_v2 = new ReCaptchaBuilderV2('api_site_key', 'api_secret_key', 3); |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -20,93 +20,93 @@ |
||
20 | 20 | */ |
21 | 21 | class ReCaptchaV3Test extends TestCase { |
22 | 22 | |
23 | - protected $recaptcha_v3 = null; |
|
24 | - |
|
25 | - /** |
|
26 | - * @test |
|
27 | - */ |
|
28 | - public function testGetApiVersion() { |
|
29 | - |
|
30 | - $this->assertEquals($this->recaptcha_v3->getVersion(), 'v3'); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @test |
|
35 | - */ |
|
36 | - public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() { |
|
37 | - |
|
38 | - $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(); |
|
39 | - $this->assertRegexp('/csrfToken/', $r); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * @test |
|
44 | - */ |
|
45 | - public function testAction() { |
|
46 | - |
|
47 | - $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']); |
|
48 | - $this->assertRegexp('/someAction/', $r); |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @test |
|
53 | - */ |
|
54 | - public function testFetchCallbackFunction() { |
|
55 | - |
|
56 | - $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']); |
|
57 | - $this->assertRegexp('/functionCallbackThen\(response\)/', $r); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * @test |
|
62 | - */ |
|
63 | - public function testcCatchCallbackFunction() { |
|
64 | - |
|
65 | - $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']); |
|
66 | - $this->assertRegexp('/functionCallbackCatch\(err\)/', $r); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * @test |
|
71 | - */ |
|
72 | - public function testCustomValidationFunction() { |
|
73 | - |
|
74 | - $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']); |
|
75 | - $this->assertRegexp('/functionCustomValidation\(token\)/', $r); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * @test |
|
80 | - */ |
|
81 | - public function testValidateController() { |
|
82 | - |
|
83 | - $controller = App::make(ReCaptchaController::class); |
|
84 | - $return = $controller->validateV3(); |
|
85 | - |
|
86 | - $this->assertArrayHasKey("success", $return); |
|
87 | - $this->assertArrayHasKey("error-codes", $return); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Define environment setup. |
|
92 | - * |
|
93 | - * @param \Illuminate\Foundation\Application $app |
|
94 | - * |
|
95 | - * @return void |
|
96 | - */ |
|
97 | - protected function getEnvironmentSetUp($app) { |
|
98 | - |
|
99 | - $app['config']->set('recaptcha.version', 'v3'); |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Setup the test environment. |
|
104 | - */ |
|
105 | - protected function setUp(): void { |
|
106 | - |
|
107 | - parent::setUp(); // TODO: Change the autogenerated stub |
|
108 | - |
|
109 | - $this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key', 3); |
|
110 | - |
|
111 | - } |
|
23 | + protected $recaptcha_v3 = null; |
|
24 | + |
|
25 | + /** |
|
26 | + * @test |
|
27 | + */ |
|
28 | + public function testGetApiVersion() { |
|
29 | + |
|
30 | + $this->assertEquals($this->recaptcha_v3->getVersion(), 'v3'); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @test |
|
35 | + */ |
|
36 | + public function testHtmlScriptTagJsApiV3GetHtmlScriptTag() { |
|
37 | + |
|
38 | + $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(); |
|
39 | + $this->assertRegexp('/csrfToken/', $r); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * @test |
|
44 | + */ |
|
45 | + public function testAction() { |
|
46 | + |
|
47 | + $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['action' => 'someAction']); |
|
48 | + $this->assertRegexp('/someAction/', $r); |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @test |
|
53 | + */ |
|
54 | + public function testFetchCallbackFunction() { |
|
55 | + |
|
56 | + $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_then' => 'functionCallbackThen']); |
|
57 | + $this->assertRegexp('/functionCallbackThen\(response\)/', $r); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * @test |
|
62 | + */ |
|
63 | + public function testcCatchCallbackFunction() { |
|
64 | + |
|
65 | + $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['callback_catch' => 'functionCallbackCatch']); |
|
66 | + $this->assertRegexp('/functionCallbackCatch\(err\)/', $r); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * @test |
|
71 | + */ |
|
72 | + public function testCustomValidationFunction() { |
|
73 | + |
|
74 | + $r = $this->recaptcha_v3->htmlScriptTagJsApiV3(['custom_validation' => 'functionCustomValidation']); |
|
75 | + $this->assertRegexp('/functionCustomValidation\(token\)/', $r); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * @test |
|
80 | + */ |
|
81 | + public function testValidateController() { |
|
82 | + |
|
83 | + $controller = App::make(ReCaptchaController::class); |
|
84 | + $return = $controller->validateV3(); |
|
85 | + |
|
86 | + $this->assertArrayHasKey("success", $return); |
|
87 | + $this->assertArrayHasKey("error-codes", $return); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Define environment setup. |
|
92 | + * |
|
93 | + * @param \Illuminate\Foundation\Application $app |
|
94 | + * |
|
95 | + * @return void |
|
96 | + */ |
|
97 | + protected function getEnvironmentSetUp($app) { |
|
98 | + |
|
99 | + $app['config']->set('recaptcha.version', 'v3'); |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Setup the test environment. |
|
104 | + */ |
|
105 | + protected function setUp(): void { |
|
106 | + |
|
107 | + parent::setUp(); // TODO: Change the autogenerated stub |
|
108 | + |
|
109 | + $this->recaptcha_v3 = new ReCaptchaBuilderV3('api_site_key', 'api_secret_key', 3); |
|
110 | + |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | \ No newline at end of file |
@@ -13,59 +13,59 @@ |
||
13 | 13 | */ |
14 | 14 | return [ |
15 | 15 | |
16 | - /** |
|
17 | - * |
|
18 | - * The site key |
|
19 | - * get site key @ www.google.com/recaptcha/admin |
|
20 | - * |
|
21 | - */ |
|
22 | - 'api_site_key' => env('RECAPTCHA_SITE_KEY', ''), |
|
16 | + /** |
|
17 | + * |
|
18 | + * The site key |
|
19 | + * get site key @ www.google.com/recaptcha/admin |
|
20 | + * |
|
21 | + */ |
|
22 | + 'api_site_key' => env('RECAPTCHA_SITE_KEY', ''), |
|
23 | 23 | |
24 | - /** |
|
25 | - * |
|
26 | - * The secret key |
|
27 | - * get secret key @ www.google.com/recaptcha/admin |
|
28 | - * |
|
29 | - */ |
|
30 | - 'api_secret_key' => env('RECAPTCHA_SECRET_KEY', ''), |
|
24 | + /** |
|
25 | + * |
|
26 | + * The secret key |
|
27 | + * get secret key @ www.google.com/recaptcha/admin |
|
28 | + * |
|
29 | + */ |
|
30 | + 'api_secret_key' => env('RECAPTCHA_SECRET_KEY', ''), |
|
31 | 31 | |
32 | - /** |
|
33 | - * |
|
34 | - * ReCATCHA version |
|
35 | - * Supported: "v2", "invisible", "v3", |
|
36 | - * |
|
37 | - * get more info @ https://developers.google.com/recaptcha/docs/versions |
|
38 | - * |
|
39 | - */ |
|
40 | - 'version' => env('RECAPTCHA_DEFAULT_VERSION', 'v2'), |
|
32 | + /** |
|
33 | + * |
|
34 | + * ReCATCHA version |
|
35 | + * Supported: "v2", "invisible", "v3", |
|
36 | + * |
|
37 | + * get more info @ https://developers.google.com/recaptcha/docs/versions |
|
38 | + * |
|
39 | + */ |
|
40 | + 'version' => env('RECAPTCHA_DEFAULT_VERSION', 'v2'), |
|
41 | 41 | |
42 | - /** |
|
43 | - * |
|
44 | - * The curl timout in seconds to validate a recaptcha token |
|
45 | - * |
|
46 | - */ |
|
47 | - 'curl_timeout' => env('RECAPTCHA_CURL_TIMEOUT', 3), |
|
42 | + /** |
|
43 | + * |
|
44 | + * The curl timout in seconds to validate a recaptcha token |
|
45 | + * |
|
46 | + */ |
|
47 | + 'curl_timeout' => env('RECAPTCHA_CURL_TIMEOUT', 3), |
|
48 | 48 | |
49 | - /** |
|
50 | - * |
|
51 | - * IP addresses for which validation will be skipped |
|
52 | - * |
|
53 | - */ |
|
54 | - 'skip_ip' => [], |
|
49 | + /** |
|
50 | + * |
|
51 | + * IP addresses for which validation will be skipped |
|
52 | + * |
|
53 | + */ |
|
54 | + 'skip_ip' => [], |
|
55 | 55 | |
56 | - /** |
|
57 | - * |
|
58 | - * Default route called to check the Google reCAPTCHA token |
|
59 | - * @since v3.2.0 |
|
60 | - * |
|
61 | - */ |
|
62 | - 'default_validation_route' => env('RECAPTCHA_DEFAULT_VALIDATION_ROUTE', 'biscolab-recaptcha/validate'), |
|
56 | + /** |
|
57 | + * |
|
58 | + * Default route called to check the Google reCAPTCHA token |
|
59 | + * @since v3.2.0 |
|
60 | + * |
|
61 | + */ |
|
62 | + 'default_validation_route' => env('RECAPTCHA_DEFAULT_VALIDATION_ROUTE', 'biscolab-recaptcha/validate'), |
|
63 | 63 | |
64 | - /** |
|
65 | - * |
|
66 | - * The name of the parameter used to send Google reCAPTCHA token to verify route |
|
67 | - * @since v3.2.0 |
|
68 | - * |
|
69 | - */ |
|
70 | - 'default_token_parameter_name' => env('RECAPTCHA_DEFAULT_TOKEN_PARAMETER_NAME', 'token') |
|
64 | + /** |
|
65 | + * |
|
66 | + * The name of the parameter used to send Google reCAPTCHA token to verify route |
|
67 | + * @since v3.2.0 |
|
68 | + * |
|
69 | + */ |
|
70 | + 'default_token_parameter_name' => env('RECAPTCHA_DEFAULT_TOKEN_PARAMETER_NAME', 'token') |
|
71 | 71 | ]; |
72 | 72 | \ No newline at end of file |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | class ReCaptchaBuilderV3 extends ReCaptchaBuilder { |
18 | 18 | |
19 | - /** |
|
20 | - * ReCaptchaBuilderV3 constructor. |
|
21 | - * |
|
22 | - * @param string $api_site_key |
|
23 | - * @param string $api_secret_key |
|
24 | - * @param int $curl_timeout |
|
25 | - */ |
|
26 | - public function __construct(string $api_site_key, string $api_secret_key, int $curl_timeout) { |
|
19 | + /** |
|
20 | + * ReCaptchaBuilderV3 constructor. |
|
21 | + * |
|
22 | + * @param string $api_site_key |
|
23 | + * @param string $api_secret_key |
|
24 | + * @param int $curl_timeout |
|
25 | + */ |
|
26 | + public function __construct(string $api_site_key, string $api_secret_key, int $curl_timeout) { |
|
27 | 27 | |
28 | - parent::__construct($api_site_key, $api_secret_key, 'v3', $curl_timeout); |
|
29 | - } |
|
28 | + parent::__construct($api_site_key, $api_secret_key, 'v3', $curl_timeout); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |