diff --git a/.env.example b/.env.example index f0e85000e..4871a4e86 100644 --- a/.env.example +++ b/.env.example @@ -100,10 +100,6 @@ CAPTCHA_ENABLED_ON_FORGOT_PASSWORD=false CAPTCHA_ENABLED_ON_PASSWORD_RESET=false CAPTCHA_ENABLED_ON_CURATED_REGISTER=false -# Show a captcha on login only after N failed attempts -CAPTCHA_TRIGGERS_LOGIN_ENABLED=false -CAPTCHA_TRIGGERS_LOGIN_ATTEMPTS=2 - # --- hCaptcha (driver: hcaptcha) --- CAPTCHA_SECRET= CAPTCHA_SITEKEY= diff --git a/app/Facades/Captcha.php b/app/Facades/Captcha.php index c0a4adbff..5f1fe4dc6 100644 --- a/app/Facades/Captcha.php +++ b/app/Facades/Captcha.php @@ -12,7 +12,6 @@ use Illuminate\Support\Facades\Facade; * @method static CaptchaDriver active() * @method static bool enabled() * @method static bool activeOn(string $surface) - * @method static bool activeOnLogin() * @method static array available() * @method static array rules() * @method static CaptchaDriver driver(string|null $driver = null) diff --git a/app/Http/Controllers/Admin/AdminSettingsController.php b/app/Http/Controllers/Admin/AdminSettingsController.php index 3d745ed17..d47f2c68e 100644 --- a/app/Http/Controllers/Admin/AdminSettingsController.php +++ b/app/Http/Controllers/Admin/AdminSettingsController.php @@ -744,7 +744,6 @@ trait AdminSettingsController ConfigCacheService::put('captcha.active.forgotpassword', $request->boolean('captcha_on_forgotpassword')); ConfigCacheService::put('captcha.active.password_reset', $request->boolean('captcha_on_password_reset')); ConfigCacheService::put('captcha.active.curated_register', $request->boolean('captcha_on_curated_register')); - ConfigCacheService::put('captcha.triggers.login.enabled', $request->boolean('captcha_on_login')); ConfigCacheService::put('captcha.enabled', true); } else { ConfigCacheService::put('captcha.enabled', false); diff --git a/config/captcha.php b/config/captcha.php index 8274f3b80..ec5750c22 100644 --- a/config/captcha.php +++ b/config/captcha.php @@ -88,6 +88,4 @@ return [ 'password_reset' => env('CAPTCHA_ENABLED_ON_PASSWORD_RESET', false), 'curated_register' => env('CAPTCHA_ENABLED_ON_CURATED_REGISTER', false), ], - - /* ]; diff --git a/tests/Feature/CaptchaManagerTest.php b/tests/Feature/CaptchaManagerTest.php index 34168ef32..253e0c9f9 100644 --- a/tests/Feature/CaptchaManagerTest.php +++ b/tests/Feature/CaptchaManagerTest.php @@ -111,36 +111,6 @@ class CaptchaManagerTest extends TestCase $this->assertTrue($manager->activeOn('curated_register')); } - #[Test] - public function active_on_login_honors_surface_and_attempt_trigger(): void - { - // Surface directly active - config([ - 'captcha.enabled' => true, - 'captcha.active.login' => true, - 'captcha.triggers.login.enabled' => false, - ]); - $this->assertTrue($this->manager()->activeOnLogin()); - - // Surface off, trigger disabled -> false - config(['captcha.active.login' => false]); - $this->assertFalse($this->manager()->activeOnLogin()); - - // Trigger enabled but below threshold -> false - config([ - 'captcha.triggers.login.enabled' => true, - 'captcha.triggers.login.attempts' => 2, - ]); - $session = $this->app['session']->driver(); - request()->setLaravelSession($session); - $session->put('login_attempts', 1); - $this->assertFalse($this->manager()->activeOnLogin()); - - // Trigger enabled and at threshold -> true - $session->put('login_attempts', 2); - $this->assertTrue($this->manager()->activeOnLogin()); - } - #[Test] public function cap_widget_defaults_to_latest_when_no_version_set(): void {