Remove recaptcha_mirror option
This commit is contained in:
parent
1fa155c213
commit
2397ebc565
|
|
@ -236,7 +236,6 @@ class AdminController extends Controller
|
||||||
$recaptcha = Option::form('recaptcha', 'reCAPTCHA', function ($form) {
|
$recaptcha = Option::form('recaptcha', 'reCAPTCHA', function ($form) {
|
||||||
$form->text('recaptcha_sitekey', 'sitekey');
|
$form->text('recaptcha_sitekey', 'sitekey');
|
||||||
$form->text('recaptcha_secretkey', 'secretkey');
|
$form->text('recaptcha_secretkey', 'secretkey');
|
||||||
$form->checkbox('recaptcha_mirror')->label();
|
|
||||||
})->handle();
|
})->handle();
|
||||||
|
|
||||||
return view('admin.options')
|
return view('admin.options')
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,7 @@ class Captcha implements Rule
|
||||||
$secretkey = option('recaptcha_secretkey');
|
$secretkey = option('recaptcha_secretkey');
|
||||||
if ($secretkey) {
|
if ($secretkey) {
|
||||||
$client = new \GuzzleHttp\Client();
|
$client = new \GuzzleHttp\Client();
|
||||||
$url = option('recaptcha_mirror')
|
$response = $client->post('https://www.recaptcha.net/recaptcha/api/siteverify', [
|
||||||
? 'https://www.recaptcha.net/recaptcha/api/siteverify'
|
|
||||||
: 'https://www.google.com/recaptcha/api/siteverify';
|
|
||||||
$response = $client->post($url, [
|
|
||||||
'form_params' => [
|
'form_params' => [
|
||||||
'secret' => $secretkey,
|
'secret' => $secretkey,
|
||||||
'response' => $value,
|
'response' => $value,
|
||||||
|
|
|
||||||
|
|
@ -52,5 +52,4 @@ return [
|
||||||
'cdn_address' => '',
|
'cdn_address' => '',
|
||||||
'recaptcha_sitekey' => '',
|
'recaptcha_sitekey' => '',
|
||||||
'recaptcha_secretkey' => '',
|
'recaptcha_secretkey' => '',
|
||||||
'recaptcha_mirror' => 'false',
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,6 @@ meta:
|
||||||
meta_extras:
|
meta_extras:
|
||||||
title: Other Custom <meta> Tags
|
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!
|
res-warning: This page is ONLY for advanced users. If you aren't familiar with these, please don't modify them!
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,6 @@ meta:
|
||||||
meta_extras:
|
meta_extras:
|
||||||
title: 其它自定义 <meta> 标签
|
title: 其它自定义 <meta> 标签
|
||||||
|
|
||||||
recaptcha:
|
|
||||||
recaptcha_mirror:
|
|
||||||
title: 第三方镜像
|
|
||||||
label: 国内用户请勾选此项
|
|
||||||
|
|
||||||
res-warning: 本页面仅供高级用户使用。如果您不清楚这些设置的含义,请不要随意修改它们!
|
res-warning: 本页面仅供高级用户使用。如果您不清楚这些设置的含义,请不要随意修改它们!
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,4 @@
|
||||||
@if (option('recaptcha_sitekey'))
|
@if (option('recaptcha_sitekey'))
|
||||||
<script
|
<script src="https://www.recaptcha.net/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer>
|
||||||
src="https://www.{{ option('recaptcha_mirror')
|
|
||||||
? 'recaptcha.net'
|
|
||||||
: 'google.com'
|
|
||||||
}}/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit"
|
|
||||||
async
|
|
||||||
defer
|
|
||||||
>
|
|
||||||
</script>
|
</script>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
||||||
|
|
@ -163,11 +163,9 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||||
$this->visit('/admin/options')
|
$this->visit('/admin/options')
|
||||||
->type('key', 'recaptcha_sitekey')
|
->type('key', 'recaptcha_sitekey')
|
||||||
->type('secret', 'recaptcha_secretkey')
|
->type('secret', 'recaptcha_secretkey')
|
||||||
->check('recaptcha_mirror')
|
|
||||||
->press('submit_recaptcha');
|
->press('submit_recaptcha');
|
||||||
$this->assertEquals('key', option('recaptcha_sitekey'));
|
$this->assertEquals('key', option('recaptcha_sitekey'));
|
||||||
$this->assertEquals('secret', option('recaptcha_secretkey'));
|
$this->assertEquals('secret', option('recaptcha_secretkey'));
|
||||||
$this->assertTrue(option('recaptcha_mirror'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResource()
|
public function testResource()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user