Skip to content

Commit a8a8d98

Browse files
authored
Merge pull request #5 from ianchb/1.2
Bump to 1.2
2 parents f3b2c80 + 9208943 commit a8a8d98

File tree

4 files changed

+44
-19
lines changed

4 files changed

+44
-19
lines changed

conf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "reCAPTCHA",
3-
"brief": "Never gonna give you up",
4-
"version": "1.0",
3+
"brief": "请勿在sitekey与secret填写有误的情况下启用登录模块验证,因为这将导致管理员无法登录后台。如果没有获取sitekey与secret,请先不要启用模块。",
4+
"version": "1.2",
55
"bbs_version": "4.0",
6-
"installed": 1,
7-
"enable": 1,
6+
"installed": 0,
7+
"enable": 0,
88
"hooks_rank": [],
99
"dependencies": []
1010
}

hook/template.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
document.getElementById('recaptchaValidator').value = grecaptcha.getResponse();
77
}
88
</script>
9-
<input type="hidden" name="recaptcha" id="recaptchaValidator" />
9+
<input type="hidden" name="recaptcha" id="recaptchaValidator" />

hook/thread_quick_reply_left_start.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
$script = <<<SCRIPT
55
SCRIPT;
66
echo getRecaptchaScript('quick_reply', $script);
7-
?>
7+
?>

setting.htm

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>
22
<form class="card">
33
<div class="card-body">
4+
<h2>
5+
reCAPTCHA for Xiuno
6+
</h2>
7+
<div class="alert alert-info">
8+
<div>要开始使用本插件,请前往:
9+
<a href="https://www.google.com/recaptcha/admin/create" target="_blank">Google reCAPTCHA</a>
10+
</div>
11+
<div>请确保sitekey与secret<strong>填写准确无误</strong>,再启用相关模块。</div>
12+
</div>
13+
<div class="alert alert-warning"><strong>警告!</strong>请勿在sitekey与secret填写有误的情况下启用登录模块验证,因为这将导致管理员无法登录后台。如果没有获取sitekey与secret,请先<a href="/admin/?plugin-disable-xn_recaptcha.htm" target="_blank">点击禁用模块</a></div>
414
<div class="alert alert-success msg" style="display: none">
515
</div>
16+
<div class="alert alert-danger msg2" style="display: none">
17+
</div>
618
<div class="row">
719
<div class="form-group row col-lg-6">
820
<label for="sitekey" class="col-sm-12 col-form-label">sitekey</label>
@@ -23,7 +35,7 @@
2335
<input class="form-check-input" <?php if(!empty($config[ 'enable'][ 'user_login'])) {?> checked
2436
<?php }?> type="checkbox" name="enable[user_login]" id="user_login">
2537
<label class="form-check-label" for="user_login">
26-
登陆模块
38+
登录模块
2739
</label>
2840
</div>
2941
<div class="col">
@@ -63,18 +75,31 @@
6375
</form>
6476
<script src="../view/js/jquery-3.1.0.js<?php echo $static_version;?>"></script>
6577
<script>
66-
var timer = null;
78+
var timer = null;
6779
$('.submit').click(function () {
68-
$.post('', $('form').serialize(), function (r) {
69-
if (r && r.code === 1) {
70-
$('.msg').text('修改成功').show();
71-
} else {
72-
$('.msg').text(JSON.stringify(r)).show();
80+
var v1=document.getElementById("sitekey").value;
81+
var v2=document.getElementById("secret").value;
82+
if (v1==null || v1=="" || v2=="" || v2==null)
83+
{
84+
$('.msg2').text('修改无效:请正确填写 sitekey 和/或 secret').show();
85+
timer && clearTimeout(timer);
86+
timer = setTimeout(function() {
87+
$('.msg2').hide();
88+
}, 2000)
7389
}
74-
timer && clearTimeout(timer);
75-
timer = setTimeout(function() {
76-
$('.msg').hide();
77-
}, 1500)
78-
}, 'json')
79-
})
90+
else
91+
{
92+
$.post('', $('form').serialize(), function (r) {
93+
if (r && r.code === 1) {
94+
$('.msg').text('修改成功').show();
95+
} else {
96+
$('.msg2').text(JSON.stringify(r)).show();
97+
}
98+
timer && clearTimeout(timer);
99+
timer = setTimeout(function() {
100+
$('.msg').hide();
101+
$('.msg2').hide();
102+
}, 1500)
103+
}, 'json')}
104+
})
80105
</script>

0 commit comments

Comments
 (0)