diff --git a/config/login-captcha.php b/config/login-captcha.php index 6a3ecef..f83b59b 100644 --- a/config/login-captcha.php +++ b/config/login-captcha.php @@ -11,6 +11,8 @@ */ return [ + 'enabled' => true, + 'length' => 4, 'charset' => 'abcdefghijklmnpqrstuvwxyz23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', diff --git a/src/LoginCaptchaServiceProvider.php b/src/LoginCaptchaServiceProvider.php index 01a90fc..7bf5758 100644 --- a/src/LoginCaptchaServiceProvider.php +++ b/src/LoginCaptchaServiceProvider.php @@ -158,6 +158,11 @@ protected function extendValidator(): self protected function bootingCaptcha(): self { Admin::booting(function (): void { + $this->config = array_replace_recursive($this->config, config('admin.login_captcha', [])); + if (! self::setting('enabled')) { + return; + } + $loginPath = ltrim(admin_base_path('auth/login'), '/'); if (Helper::matchRequestPath("GET:$loginPath")) { Admin::script((string) view(sprintf('%s::captcha', $this->getName())));