mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Create config screen for reCAPTCHA in spamfilter module
This commit is contained in:
parent
9c60a8932c
commit
c7c03d3c37
13 changed files with 283 additions and 30 deletions
|
|
@ -1,10 +1,5 @@
|
|||
<include target="./header.html" />
|
||||
<section class="section">
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" method="post" id="spamfilterConfig" class="x_form-horizontal">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertConfig" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
|
|
@ -41,7 +36,7 @@
|
|||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="custom_message">{$lang->custom_message}</label>
|
||||
<div class="x_controls">
|
||||
<textarea name="custom_message" id="custom_message" class="lang_code">{htmlspecialchars($config->custom_message)}</textarea>
|
||||
<textarea name="custom_message" id="custom_message" class="lang_code">{escape($config->custom_message, false)}</textarea>
|
||||
<p class="x_help-block">{$lang->about_custom_message}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
120
modules/spamfilter/tpl/config_captcha.html
Normal file
120
modules/spamfilter/tpl/config_captcha.html
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<config autoescape="on" />
|
||||
<include target="./header.html" />
|
||||
<section class="section">
|
||||
<form action="./" method="post" id="spamfilterConfig" class="x_form-horizontal">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminInsertConfigCaptcha" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/spamfilter/tpl/2" />
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="captcha_type">{$lang->use_captcha}</label>
|
||||
<div class="x_controls">
|
||||
<select id="captcha_type" name="captcha_type">
|
||||
<option value="none" selected="selected"|cond="$config->captcha->type === 'none'">{$lang->notuse}</option>
|
||||
<option value="recaptcha" selected="selected"|cond="$config->captcha->type === 'recaptcha'">reCAPTCHA</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="site_key">Site Key</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="site_key" name="site_key" value="{$config->captcha->site_key}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="secret_key">Secret Key</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="secret_key" name="secret_key" value="{$config->captcha->secret_key}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="captcha_theme">{$lang->recaptcha_theme}</label>
|
||||
<div class="x_controls">
|
||||
<select id="captcha_theme" name="captcha_theme">
|
||||
<option value="light" selected="selected"|cond="$config->captcha->theme === 'light'">{$lang->recaptcha_theme_light}</option>
|
||||
<option value="dark" selected="selected"|cond="$config->captcha->theme === 'dark'">{$lang->recaptcha_theme_dark}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="captcha_size">{$lang->recaptcha_size}</label>
|
||||
<div class="x_controls">
|
||||
<select id="captcha_size" name="captcha_size">
|
||||
<option value="normal" selected="selected"|cond="$config->captcha->size === 'normal'">{$lang->recaptcha_size_normal}</option>
|
||||
<option value="compact" selected="selected"|cond="$config->captcha->size === 'compact'">{$lang->recaptcha_size_compact}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->recaptcha_target_devices}</label>
|
||||
<div class="x_controls">
|
||||
<label for="target_devices_pc" class="x_inline">
|
||||
<input type="checkbox" id="target_devices_pc" name="target_devices[]" value="pc" checked="checked"|cond="$config->captcha->target_devices['pc']" />
|
||||
{$lang->pc}
|
||||
</label>
|
||||
<label for="target_devices_mobile" class="x_inline">
|
||||
<input type="checkbox" id="target_devices_mobile" name="target_devices[]" value="mobile" checked="checked"|cond="$config->captcha->target_devices['mobile']" />
|
||||
{$lang->mobile}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->recaptcha_target_actions}</label>
|
||||
<div class="x_controls">
|
||||
<label for="target_actions_signup" class="x_inline">
|
||||
<input type="checkbox" id="target_actions_signup" name="target_actions[]" value="signup" checked="checked"|cond="$config->captcha->target_actions['signup']" />
|
||||
{$lang->cmd_signup}
|
||||
</label>
|
||||
<label for="target_actions_login" class="x_inline">
|
||||
<input type="checkbox" id="target_actions_login" name="target_actions[]" value="login" checked="checked"|cond="$config->captcha->target_actions['login']" />
|
||||
{$lang->cmd_login}
|
||||
</label>
|
||||
<label for="target_actions_recovery" class="x_inline">
|
||||
<input type="checkbox" id="target_actions_recovery" name="target_actions[]" value="recovery" checked="checked"|cond="$config->captcha->target_actions['recovery']" />
|
||||
{$lang->cmd_find_member_account}
|
||||
</label>
|
||||
<label for="target_actions_document" class="x_inline">
|
||||
<input type="checkbox" id="target_actions_document" name="target_actions[]" value="document" checked="checked"|cond="$config->captcha->target_actions['document']" />
|
||||
{$lang->recaptcha_target_document}
|
||||
</label>
|
||||
<label for="target_actions_comment" class="x_inline">
|
||||
<input type="checkbox" id="target_actions_comment" name="target_actions[]" value="comment" checked="checked"|cond="$config->captcha->target_actions['comment']" />
|
||||
{$lang->recaptcha_target_comment}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->recaptcha_target_users}</label>
|
||||
<div class="x_controls">
|
||||
<label for="target_users_1" class="x_inline">
|
||||
<input type="radio" id="target_users_1" name="target_users" value="non_members" checked="checked"|cond="$config->captcha->target_users === 'non_members'" />
|
||||
{$lang->recaptcha_target_guest}
|
||||
</label>
|
||||
<label for="target_users_2" class="x_inline">
|
||||
<input type="radio" id="target_users_2" name="target_users" value="everyone" checked="checked"|cond="$config->captcha->target_users === 'everyone'" />
|
||||
{$lang->recaptcha_target_everyone}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->recaptcha_target_frequency}</label>
|
||||
<div class="x_controls">
|
||||
<label for="target_frequency_1" class="x_inline">
|
||||
<input type="radio" id="target_frequency_1" name="target_frequency" value="first_time_only" checked="checked"|cond="$config->captcha->target_frequency === 'first_time_only'" />
|
||||
{$lang->recaptcha_target_first_time_only}
|
||||
</label>
|
||||
<label for="target_frequency_2" class="x_inline">
|
||||
<input type="radio" id="target_frequency_2" name="target_frequency" value="every_time" checked="checked"|cond="$config->captcha->target_frequency === 'every_time'" />
|
||||
{$lang->recaptcha_target_every_time}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_clearfix btnArea">
|
||||
<div class="x_pull-right">
|
||||
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<include target="./footer.html" />
|
||||
|
||||
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
<include target="./header.html" />
|
||||
<section>
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminDeleteDeniedIP" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<include target="./header.html" />
|
||||
<section>
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li class="x_active"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
</ul>
|
||||
<form action="./" method="post">
|
||||
<input type="hidden" name="act" value="procSpamfilterAdminDeleteDeniedWord" />
|
||||
<input type="hidden" name="module" value="spamfilter" />
|
||||
|
|
|
|||
|
|
@ -6,3 +6,9 @@
|
|||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/spamfilter/tpl/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
<ul class="x_nav x_nav-tabs">
|
||||
<li class="x_active"|cond="$act === 'dispSpamfilterAdminDeniedIPList'"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedIPList')}">{$lang->cmd_denied_ip}</a></li>
|
||||
<li class="x_active"|cond="$act === 'dispSpamfilterAdminDeniedWordList'"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminDeniedWordList')}">{$lang->cmd_denied_word}</a></li>
|
||||
<li class="x_active"|cond="$act === 'dispSpamfilterAdminConfigBlock'"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigBlock')}">{$lang->cmd_config_block}</a></li>
|
||||
<li class="x_active"|cond="$act === 'dispSpamfilterAdminConfigCaptcha'"><a href="{getUrl('','module','admin','act','dispSpamfilterAdminConfigCaptcha')}">{$lang->cmd_captcha_config}</a></li>
|
||||
</ul>
|
||||
|
|
|
|||
40
modules/spamfilter/tpl/js/recaptcha.js
Normal file
40
modules/spamfilter/tpl/js/recaptcha.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
function reCaptchaCallback() {
|
||||
var recaptcha_config = $("#recaptcha-config");
|
||||
var recaptcha_instances = $(".g-recaptcha");
|
||||
var recaptcha_instance_id = 1;
|
||||
|
||||
if (recaptcha_instances.size() === 0) {
|
||||
var autoinsert_candidates = $("form").filter(function() {
|
||||
var actinput = $("input[name='act']", this);
|
||||
if (actinput.size() && actinput.val() && actinput.val().match(/^proc.+(Insert(Document|Comment|)|Login|FindAccount|ResendAuthMail)/i)) {
|
||||
return true;
|
||||
}
|
||||
var procfilter = $(this).attr("onsubmit");
|
||||
if (procfilter && procfilter.match(/procFilter\b.+\binsert/i)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
autoinsert_candidates.each(function() {
|
||||
var new_instance = $('<div class="g-recaptcha"></div>');
|
||||
new_instance.attr("id", "recaptcha-instance-" + recaptcha_instance_id++);
|
||||
var autoinsert_point = $(this).find("button[type='submit'],input[type='submit']").parent();
|
||||
if (autoinsert_point.size()) {
|
||||
new_instance.insertBefore(autoinsert_point);
|
||||
} else {
|
||||
new_instance.appendTo($(this));
|
||||
}
|
||||
});
|
||||
var recaptcha_instances = $(".g-recaptcha");
|
||||
}
|
||||
|
||||
recaptcha_instances.each(function() {
|
||||
var instance = $(this);
|
||||
grecaptcha.render(instance.attr("id"), {
|
||||
sitekey: recaptcha_config.data("sitekey"),
|
||||
size: recaptcha_config.data("size"),
|
||||
theme: recaptcha_config.data("theme")
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue