From 2397ebc5655aaa58780f31ec1a1c818e49c8062a Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sun, 24 Mar 2019 10:14:27 +0800 Subject: [PATCH] Remove `recaptcha_mirror` option --- app/Http/Controllers/AdminController.php | 1 - app/Rules/Captcha.php | 5 +---- config/options.php | 1 - resources/lang/en/options.yml | 5 ----- resources/lang/zh_CN/options.yml | 5 ----- resources/views/common/recaptcha.blade.php | 9 +-------- tests/AdminControllerTest.php | 2 -- 7 files changed, 2 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 7a694e2a..49a64cda 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -236,7 +236,6 @@ class AdminController extends Controller $recaptcha = Option::form('recaptcha', 'reCAPTCHA', function ($form) { $form->text('recaptcha_sitekey', 'sitekey'); $form->text('recaptcha_secretkey', 'secretkey'); - $form->checkbox('recaptcha_mirror')->label(); })->handle(); return view('admin.options') diff --git a/app/Rules/Captcha.php b/app/Rules/Captcha.php index 9a1e4190..fc915a05 100644 --- a/app/Rules/Captcha.php +++ b/app/Rules/Captcha.php @@ -15,10 +15,7 @@ class Captcha implements Rule $secretkey = option('recaptcha_secretkey'); if ($secretkey) { $client = new \GuzzleHttp\Client(); - $url = option('recaptcha_mirror') - ? 'https://www.recaptcha.net/recaptcha/api/siteverify' - : 'https://www.google.com/recaptcha/api/siteverify'; - $response = $client->post($url, [ + $response = $client->post('https://www.recaptcha.net/recaptcha/api/siteverify', [ 'form_params' => [ 'secret' => $secretkey, 'response' => $value, diff --git a/config/options.php b/config/options.php index a36ff41c..613f7e51 100644 --- a/config/options.php +++ b/config/options.php @@ -52,5 +52,4 @@ return [ 'cdn_address' => '', 'recaptcha_sitekey' => '', 'recaptcha_secretkey' => '', - 'recaptcha_mirror' => 'false', ]; diff --git a/resources/lang/en/options.yml b/resources/lang/en/options.yml index e648a277..627462dc 100644 --- a/resources/lang/en/options.yml +++ b/resources/lang/en/options.yml @@ -146,11 +146,6 @@ meta: meta_extras: title: Other Custom Tags -recaptcha: - recaptcha_mirror: - title: 3rd-party Mirror - label: Chinese users only. - res-warning: This page is ONLY for advanced users. If you aren't familiar with these, please don't modify them! resources: diff --git a/resources/lang/zh_CN/options.yml b/resources/lang/zh_CN/options.yml index c44b84c5..c7a4bead 100644 --- a/resources/lang/zh_CN/options.yml +++ b/resources/lang/zh_CN/options.yml @@ -146,11 +146,6 @@ meta: meta_extras: title: 其它自定义 标签 -recaptcha: - recaptcha_mirror: - title: 第三方镜像 - label: 国内用户请勾选此项 - res-warning: 本页面仅供高级用户使用。如果您不清楚这些设置的含义,请不要随意修改它们! resources: diff --git a/resources/views/common/recaptcha.blade.php b/resources/views/common/recaptcha.blade.php index 22ea2773..90bc5671 100644 --- a/resources/views/common/recaptcha.blade.php +++ b/resources/views/common/recaptcha.blade.php @@ -1,11 +1,4 @@ @if (option('recaptcha_sitekey')) - @endif diff --git a/tests/AdminControllerTest.php b/tests/AdminControllerTest.php index 4e0ee031..3ee73df9 100644 --- a/tests/AdminControllerTest.php +++ b/tests/AdminControllerTest.php @@ -163,11 +163,9 @@ class AdminControllerTest extends BrowserKitTestCase $this->visit('/admin/options') ->type('key', 'recaptcha_sitekey') ->type('secret', 'recaptcha_secretkey') - ->check('recaptcha_mirror') ->press('submit_recaptcha'); $this->assertEquals('key', option('recaptcha_sitekey')); $this->assertEquals('secret', option('recaptcha_secretkey')); - $this->assertTrue(option('recaptcha_mirror')); } public function testResource()