Skip to content

Commit fd8e61d

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents b0f5762 + e67babb commit fd8e61d

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ This package requires the following dependencies:
9494
Via Composer
9595

9696
``` sh
97-
$ composer require timehunter/laravel-google-recaptcha-v3 "~2.3.1" -vvv
97+
$ composer require timehunter/laravel-google-recaptcha-v3 "~2.4.0" -vvv
9898
```
9999

100100
If your Laravel framework version <= 5.4, please register the service provider under your config file: /config/app.php, otherwise please skip it.
@@ -572,6 +572,7 @@ Thank you for the following contributors, You guys are the BEST!
572572
* [@demiurge-ash](https://github.com/demiurge-ash)
573573
* [@lxlang](https://github.com/lxlang)
574574
* [@Indianos](https://github.com/Indianos)
575+
* [@ericp-mrel](https://github.com/ericp-mrel)
575576

576577
## Security
577578

resources/lang/en/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
'ERROR_SCORE_THRESHOLD' => 'Score does not meet threshold.',
99
'ERROR_TIMEOUT' => 'Timeout',
1010
'SUCCESS' => 'Successfully passed.',
11-
'TIMEOUT_OR_DUPLICATE'=> 'The action is timeout.'
11+
'TIMEOUT_OR_DUPLICATE'=> 'The action is timeout.',
1212
];

resources/lang/lv/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
'ERROR_SCORE_THRESHOLD' => 'Vērtējums neatbilst minimālajam slieksnim.',
99
'ERROR_TIMEOUT' => 'Noildze',
1010
'SUCCESS' => 'Veiksmīgi apstiprināts.',
11-
'TIMEOUT_OR_DUPLICATE'=> 'Noildze'
11+
'TIMEOUT_OR_DUPLICATE'=> 'Noildze',
1212
];

resources/lang/ru/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
'ERROR_SCORE_THRESHOLD' => 'Оценка не соответствует пороговому значению.',
99
'ERROR_TIMEOUT' => 'Тайм-аут',
1010
'SUCCESS' => 'Проверка успешно пройдена.',
11-
'TIMEOUT_OR_DUPLICATE' => 'Тайм-аут'
11+
'TIMEOUT_OR_DUPLICATE' => 'Тайм-аут',
1212
];

resources/views/googlerecaptchav3/template.blade.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@if($display === false)
77
<style {!! $nonce !!}>
88
.grecaptcha-badge {
9-
display: none;
9+
visibility: hidden;
1010
}
1111
</style>
1212
@endif
@@ -51,17 +51,18 @@ function onloadCallback() {
5151
@endforeach
5252
}
5353
</script>
54-
<script id='gReCaptchaScript' src="{{$apiJsUrl}}?render=explicit&onload=onloadCallback"
54+
<script id='gReCaptchaScript' src="{{$apiJsUrl}}?render={{$inline ? 'explicit' : $publicKey}}&onload=onloadCallback"
5555
defer
5656
async {!! $nonce !!}></script>
5757
@endif
5858

5959
<script {!! $nonce !!}>
6060
function refreshReCaptchaV3(fieldId,action){
61-
grecaptcha.reset(window['client'+fieldId]);
62-
grecaptcha.ready(function () {
63-
grecaptcha.execute(window['client'+fieldId], {
64-
action: action
61+
return new Promise(function (resolve, reject) {
62+
grecaptcha.ready(function () {
63+
grecaptcha.execute(window['client'+fieldId], {
64+
action: action
65+
}).then(resolve);
6566
});
6667
});
6768
}

src/Services/GoogleReCaptchaV3Service.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function ifInSkippedIps($ip)
4444
*/
4545
public function verifyResponse($response, $ip = null)
4646
{
47-
if (!$this->config->isServiceEnabled() || ($ip && $this->ifInSkippedIps($ip)) === true) {
47+
if (! $this->config->isServiceEnabled() || ($ip && $this->ifInSkippedIps($ip)) === true) {
4848
$res = new GoogleReCaptchaV3Response([], $ip);
4949
$res->setSuccess(true);
5050

@@ -77,14 +77,15 @@ public function verifyResponse($response, $ip = null)
7777

7878
if ($rawResponse->getMessage() === 'timeout-or-duplicate') {
7979
$rawResponse->setMessage(Lang::get(GoogleReCaptchaV3Response::TIMEOUT_OR_DUPLICATE));
80+
8081
return $rawResponse;
8182
}
8283

8384
if ($rawResponse->isSuccess() === false) {
8485
return $rawResponse;
8586
}
8687

87-
if (!empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
88+
if (! empty($this->config->getHostName()) && strcasecmp($this->config->getHostName(), $rawResponse->getHostname()) !== 0) {
8889
$rawResponse->setMessage(Lang::get(GoogleReCaptchaV3Response::ERROR_HOSTNAME));
8990
$rawResponse->setSuccess(false);
9091

0 commit comments

Comments
 (0)