🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 20:43:46 +01:00
parent deed2158ca
commit 7b9849c159
77 changed files with 1084 additions and 13612 deletions
@@ -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.'));
}
}
}