diff --git a/app/Services/Captcha/TurnstileDriver.php b/app/Services/Captcha/TurnstileDriver.php index 77c5678a9..4e38dfe26 100644 --- a/app/Services/Captcha/TurnstileDriver.php +++ b/app/Services/Captcha/TurnstileDriver.php @@ -75,6 +75,7 @@ class TurnstileDriver implements CaptchaDriver public function scripts(): string { - return ''; + return '' + .''; } } diff --git a/tests/Feature/CaptchaManagerTest.php b/tests/Feature/CaptchaManagerTest.php index 1c7998a02..70a85a985 100644 --- a/tests/Feature/CaptchaManagerTest.php +++ b/tests/Feature/CaptchaManagerTest.php @@ -269,10 +269,12 @@ class CaptchaManagerTest extends TestCase public function turnstile_scripts_reference_cloudflare(): void { config(['captcha.driver' => 'turnstile']); - $this->assertStringContainsString( - 'challenges.cloudflare.com/turnstile/v0/api.js', - $this->manager()->active()->scripts() - ); + $scripts = $this->manager()->active()->scripts(); + + $this->assertStringContainsString('challenges.cloudflare.com/turnstile/v0/api.js', $scripts); + // Warms the connection to Cloudflare's challenge origin before the + // widget script fetches from it (crossorigin, since it's cross-origin). + $this->assertStringContainsString('', $scripts); } #[Test]