Remove recaptcha_mirror option

This commit is contained in:
Pig Fang 2019-03-24 10:14:27 +08:00
parent 1fa155c213
commit 2397ebc565
7 changed files with 2 additions and 26 deletions

View File

@ -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')

View File

@ -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,

View File

@ -52,5 +52,4 @@ return [
'cdn_address' => '',
'recaptcha_sitekey' => '',
'recaptcha_secretkey' => '',
'recaptcha_mirror' => 'false',
];

View File

@ -146,11 +146,6 @@ meta:
meta_extras:
title: Other Custom <meta> 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:

View File

@ -146,11 +146,6 @@ meta:
meta_extras:
title: 其它自定义 <meta> 标签
recaptcha:
recaptcha_mirror:
title: 第三方镜像
label: 国内用户请勾选此项
res-warning: 本页面仅供高级用户使用。如果您不清楚这些设置的含义,请不要随意修改它们!
resources:

View File

@ -1,11 +1,4 @@
@if (option('recaptcha_sitekey'))
<script
src="https://www.{{ option('recaptcha_mirror')
? 'recaptcha.net'
: 'google.com'
}}/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit"
async
defer
>
<script src="https://www.recaptcha.net/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer>
</script>
@endif

View File

@ -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()