Skip to content

Commit 5f66ef7

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # README.md
2 parents 2fc9bb7 + 8f1326b commit 5f66ef7

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ Example Usage
137137

138138

139139
``` php
140-
GoogleReCaptchaV3::verifyResponse($request->input('g-recaptcha-response'), $request->getClientIp())->getMessage()
140+
GoogleReCaptchaV3::verifyResponse(
141+
$request->input('g-recaptcha-response'),
142+
$request->getClientIp()
143+
)
144+
->getMessage()
141145
```
142146

143147

@@ -148,11 +152,16 @@ Example Usage
148152
If you manually assign a value to setScore($score), the code will fully skip your config file and force to check the score.
149153

150154
``` php
151-
GoogleReCaptchaV3::setScore($score)->setAction($action)->verifyResponse($request->input('g-recaptcha-response'), $request->getClientIp())->getMessage()
155+
GoogleReCaptchaV3::setScore($score)
156+
->setAction($action)
157+
->verifyResponse(
158+
$request->input('g-recaptcha-response'),
159+
$request->getClientIp()
160+
)
161+
->getMessage()
152162
```
153163

154164

155-
156165
## Validation Class (Only support Laravel >= 5.5) <a name="validation-class" />
157166

158167
You can use provided Validation object to verify your reCAPTCHA.
@@ -492,6 +501,12 @@ Remember to register it in your own service provider
492501
```
493502

494503

504+
## Contributors <a name="contributors" />
505+
506+
Thank you for the following contributors, You guys are the BEST!
507+
508+
* [@xalunda](https://www.google.com)
509+
495510
## Security
496511

497512
If you discover any security related issues, please email ryandadeng@gmail.com instead of using the issue tracker.
@@ -515,4 +530,3 @@ MIT. Please see the [license file](license.md) for more information.
515530
[link-build]: https://travis-ci.org/RyanDaDeng/laravel-google-recaptcha-v3
516531
[link-styleci]: https://github.styleci.io/repos/146857583
517532
[link-unstable]: https://packagist.org/packages/timehunter/laravel-google-recaptcha-v3
518-

contributing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ Contributions are welcome and will be fully credited.
55
Contributions are accepted via Pull Requests on [Github](https://github.com/ryandeng/googlerecaptcha).
66

77
**Happy coding**!
8+
9+
10+
Contributors:
11+
@xalunda PR: https://github.com/RyanDaDeng/laravel-google-recaptcha-v3/pull/16

src/GoogleReCaptchaV3.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public function setAction($value = null)
9494
return $this;
9595
}
9696

97-
9897
/**
9998
* @param string|null $value
10099
* @return $this

src/Services/GoogleReCaptchaV3Service.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(ReCaptchaConfigV3Interface $config, RequestClientInt
3232
*/
3333
public function verifyResponse($response, $ip = null)
3434
{
35-
if (!$this->config->isServiceEnabled()) {
35+
if (! $this->config->isServiceEnabled()) {
3636
$res = new GoogleReCaptchaV3Response([], $ip);
3737
$res->setSuccess(true);
3838

@@ -67,7 +67,7 @@ public function verifyResponse($response, $ip = null)
6767
return $rawResponse;
6868
}
6969

70-
if (!empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
70+
if (! empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
7171
$rawResponse->setMessage(GoogleReCaptchaV3Response::ERROR_HOSTNAME);
7272
$rawResponse->setSuccess(false);
7373

@@ -84,6 +84,7 @@ public function verifyResponse($response, $ip = null)
8484
if (isset($this->score) && $this->score > $rawResponse->getScore()) {
8585
$rawResponse->setSuccess(false);
8686
$rawResponse->setMessage(GoogleReCaptchaV3Response::ERROR_SCORE_THRESHOLD);
87+
8788
return $rawResponse;
8889
} else {
8990
if ($this->getConfig()->isScoreEnabled()) {
@@ -102,7 +103,6 @@ public function verifyResponse($response, $ip = null)
102103
}
103104
}
104105

105-
106106
$rawResponse->setSuccess(true);
107107
$rawResponse->setMessage('Successfully passed.');
108108

tests/ScoreTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ public function testScore6()
217217
$this->assertEquals(true, $response->isSuccess());
218218
}
219219

220-
221220
public function testScore7()
222221
{
223222
// Create a stub for the SomeClass class.
@@ -252,7 +251,6 @@ public function testScore7()
252251
$this->assertEquals(true, $response->isSuccess());
253252
}
254253

255-
256254
public function testScore11()
257255
{
258256
// Create a stub for the SomeClass class.
@@ -287,7 +285,6 @@ public function testScore11()
287285
$this->assertEquals(false, $response->isSuccess());
288286
}
289287

290-
291288
public function testScore8()
292289
{
293290
// Create a stub for the SomeClass class.

0 commit comments

Comments
 (0)