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

Commit c067c4c

Browse files
committed
Merge branch 'feature/v4/initial' into develop
# Conflicts: # composer.json
2 parents 8a599c7 + 99d610e commit c067c4c

19 files changed

+1434
-892
lines changed

.editorconfig

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ insert_final_newline=false
55
indent_style=space
66
indent_size=4
77

8-
[{*.hphp,*.phtml,*.module,*.php,*.php5,*.php4,*.inc}]
9-
indent_style=tab
10-
tab_width=4
11-
128
[{*.yml,*.yaml}]
139
indent_style=space
14-
indent_size=2
10+
indent_size=2
11+

.gitattributes

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
/tests export-ignore
2+
/.github export-ignore
23
/.gitattributes export-ignore
34
/.gitignore export-ignore
45
/.scrutinizer.yml export-ignore
56
/.travis.yml export-ignore
7+
/.editorconfig export-ignore
68
/phpunit.xml export-ignore
79
/changelog.md export-ignore
8-
/readme.md export-ignore
10+
/README.md export-ignore
11+
/CONTRIBUTING.md export-ignore
12+
/CODE_OF_CONDUCT.md export-ignore

README.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Laravel ReCAPTCHA v3
2-
Simple and painless Google reCAPTCHA package for Laravel 5
2+
Simple and painless Google reCAPTCHA package for Laravel 5 and 6
33

44
Available reCAPTCHA versions:
55
* v2 Invisible
@@ -13,12 +13,21 @@ Available reCAPTCHA versions:
1313
## System requirements
1414
| Package | reCAPTCHA | PHP | Laravel | Docs |
1515
|-----------------|-------------|-------------|-----------------|-------------------|
16-
| 3.x |v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater | [latest](https://laravel-recaptcha-docs.biscolab.com) |
16+
| 4.x |v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 | [latest](https://laravel-recaptcha-docs.biscolab.com) |
17+
| 3.x |v3, v2 Invisible, v2 Checkbox | 7.1 or greater | 5.5 or greater, 6 ready (*) | [latest](https://laravel-recaptcha-docs.biscolab.com/docs/3.6.1/intro) |
1718
| 2.x | v2 Invisible, v2 Checkbox | 5.5.9, 7.0 or greater | 5.0 or greater | [v2.0.4](https://laravel-recaptcha-docs.biscolab.com/docs/2.0.4/intro) |
1819

19-
## !!! Documentation !!!
20+
> (*) Latest version (3.6.1) is Laravel 6 ready
21+
22+
> If you are migrating from either v2.x or v3.x to the latest package version, please, take a look about migration to v4.x in [What's new in v4.x](https://laravel-recaptcha-docs.biscolab.com/docs/whats-new) before any changes
23+
24+
## Documentation
2025

2126
You can find online complete documentation at [https://laravel-recaptcha-docs.biscolab.com/](https://laravel-recaptcha-docs.biscolab.com/).
2227

28+
## Contributing
29+
30+
Contributions are welcome and will be fully credited. [https://laravel-recaptcha-docs.biscolab.com/docs/contributing](https://laravel-recaptcha-docs.biscolab.com/docs/contributing).
31+
2332
## License
2433
[![MIT License](https://img.shields.io/github/license/biscolab/laravel-recaptcha.svg)](https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE)

composer.json

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
{
22
"name": "biscolab/laravel-recaptcha",
3-
"description": "Simple ReCaptcha package for Laravel 5",
3+
"description": "Simple ReCaptcha package for Laravel 5 and 6",
4+
"version": "4.0.0",
45
"license": "MIT",
6+
"type": "library",
7+
"keywords": [
8+
"recaptcha",
9+
"captcha",
10+
"laravel",
11+
"validation"
12+
],
13+
"homepage": "https://biscolab.com/laravel-recaptcha",
514
"authors": [
615
{
716
"name": "Roberto Belotti",
8-
"email": "[email protected]"
17+
"email": "[email protected]",
18+
"homepage": "https://biscolab.com",
19+
"role": "Developer"
920
}
1021
],
1122
"require": {
@@ -30,7 +41,7 @@
3041
}
3142
},
3243
"scripts": {
33-
"test": "phpunit"
44+
"test": "vendor/bin/phpunit --colors=always"
3445
},
3546
"extra": {
3647
"laravel": {

config/recaptcha.php

+132-66
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,136 @@
1313
*/
1414
return [
1515

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-
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-
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-
42-
/**
43-
*
44-
* The curl timout in seconds to validate a recaptcha token
45-
* @since v3.5.0
46-
*
47-
*/
48-
'curl_timeout' => env('RECAPTCHA_CURL_TIMEOUT', 10),
49-
50-
/**
51-
*
52-
* IP addresses for which validation will be skipped
53-
*
54-
*/
55-
'skip_ip' => [],
56-
57-
/**
58-
*
59-
* Default route called to check the Google reCAPTCHA token
60-
* @since v3.2.0
61-
*
62-
*/
63-
'default_validation_route' => env('RECAPTCHA_DEFAULT_VALIDATION_ROUTE', 'biscolab-recaptcha/validate'),
64-
65-
/**
66-
*
67-
* The name of the parameter used to send Google reCAPTCHA token to verify route
68-
* @since v3.2.0
69-
*
70-
*/
71-
'default_token_parameter_name' => env('RECAPTCHA_DEFAULT_TOKEN_PARAMETER_NAME', 'token'),
72-
73-
/**
74-
*
75-
* The default Google reCAPTCHA language code
76-
* It has no effect with v3
77-
* @see https://developers.google.com/recaptcha/docs/language
78-
* @since v3.6.0
79-
*
80-
*/
81-
'default_language' => env('RECAPTCHA_DEFAULT_LANGUAGE', null)
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+
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+
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' => 'v2',
41+
42+
/**
43+
*
44+
* The curl timout in seconds to validate a recaptcha token
45+
* @since v3.5.0
46+
*
47+
*/
48+
'curl_timeout' => 10,
49+
50+
/**
51+
*
52+
* IP addresses for which validation will be skipped
53+
*
54+
*/
55+
'skip_ip' => [],
56+
57+
/**
58+
*
59+
* Default route called to check the Google reCAPTCHA token
60+
* @since v3.2.0
61+
*
62+
*/
63+
'default_validation_route' => 'biscolab-recaptcha/validate',
64+
65+
/**
66+
*
67+
* The name of the parameter used to send Google reCAPTCHA token to verify route
68+
* @since v3.2.0
69+
*
70+
*/
71+
'default_token_parameter_name' => 'token',
72+
73+
/**
74+
*
75+
* The default Google reCAPTCHA language code
76+
* It has no effect with v3
77+
* @see https://developers.google.com/recaptcha/docs/language
78+
* @since v3.6.0
79+
*
80+
*/
81+
'default_language' => null,
82+
83+
/**
84+
*
85+
* The default form ID. Only for "invisible" reCAPTCHA
86+
* @since v4.0.0
87+
*
88+
*/
89+
'default_form_id' => 'biscolab-recaptcha-invisible-form',
90+
91+
/**
92+
*
93+
* Deferring the render can be achieved by specifying your onload callback function and adding parameters to the JavaScript resource.
94+
* It has no effect with v3 and invisible
95+
* @see https://developers.google.com/recaptcha/docs/display#explicit_render
96+
* @since v4.0.0
97+
* Supported true, false
98+
*
99+
*/
100+
'explicit' => false,
101+
102+
/**
103+
*
104+
* g-recaptcha tag attributes and grecaptcha.render parameters (v2 only)
105+
* @see https://developers.google.com/recaptcha/docs/display#render_param
106+
* @since v4.0.0
107+
*/
108+
'tag_attributes' => [
109+
110+
/**
111+
* The color theme of the widget.
112+
* Supported "light", "dark"
113+
*/
114+
'theme' => 'light',
115+
116+
/**
117+
* The size of the widget.
118+
* Supported "normal", "compact"
119+
*/
120+
'size' => 'normal',
121+
122+
/**
123+
* The tabindex of the widget and challenge.
124+
* If other elements in your page use tabindex, it should be set to make user navigation easier.
125+
*/
126+
'tabindex' => 0,
127+
128+
/**
129+
* The name of your callback function, executed when the user submits a successful response.
130+
* The g-recaptcha-response token is passed to your callback.
131+
* DO NOT SET "biscolabOnloadCallback"
132+
*/
133+
'callback' => null,
134+
135+
/**
136+
* The name of your callback function, executed when the reCAPTCHA response expires and the user needs to re-verify.
137+
* DO NOT SET "biscolabOnloadCallback"
138+
*/
139+
'expired-callback' => null,
140+
141+
/**
142+
* The name of your callback function, executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored.
143+
* If you specify a function here, you are responsible for informing the user that they should retry.
144+
* DO NOT SET "biscolabOnloadCallback"
145+
*/
146+
'error-callback' => null,
147+
]
82148
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2017 - present
4+
* LaravelGoogleRecaptcha - InvalidConfigurationException.php
5+
* author: Roberto Belotti - [email protected]
6+
* web : robertobelotti.com, github.com/biscolab
7+
* Initial version created on: 4/9/2019
8+
* MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE
9+
*/
10+
11+
namespace Biscolab\ReCaptcha\Exceptions;
12+
13+
class InvalidConfigurationException extends \Exception
14+
{
15+
16+
}

0 commit comments

Comments
 (0)