You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -8,11 +8,11 @@ use Illuminate\Contracts\Validation\InvokableRule;
|
||||
|
||||
class GoogleRecaptchaRule implements InvokableRule
|
||||
{
|
||||
public function __invoke(string $attribute, mixed $value, Closure $fail)
|
||||
public function __invoke(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
// If recaptcha is disabled
|
||||
if ((int) setting('google_recaptcha_enabled') === 0) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
$client = new Client;
|
||||
@@ -29,10 +29,14 @@ class GoogleRecaptchaRule implements InvokableRule
|
||||
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
$fail(__('The Google recaptcha was not successful.'));
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \stdClass $body */
|
||||
$body = json_decode((string) $response->getBody());
|
||||
|
||||
return $body->success;
|
||||
if (! isset($body->success) || ! $body->success) {
|
||||
$fail(__('The Google recaptcha was not successful.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user