mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 09:32:15 +09:00
Also separate target actions when auto-inserting CAPTCHA into forms #1815
This commit is contained in:
parent
2dc3e5e19b
commit
0970a7d7ad
3 changed files with 24 additions and 7 deletions
|
|
@ -3,15 +3,31 @@ function reCaptchaCallback() {
|
|||
var recaptcha_config = $("#recaptcha-config");
|
||||
var recaptcha_instances = $(".g-recaptcha");
|
||||
var recaptcha_instance_id = 1;
|
||||
var recaptcha_targets = String(recaptcha_config.data("targets")).split(",");
|
||||
|
||||
if (recaptcha_instances.size() === 0) {
|
||||
if (recaptcha_instances.length === 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;
|
||||
if (actinput.length && actinput.val()) {
|
||||
var act = String(actinput.val());
|
||||
if (act.match(/^procMemberInsert$/i) && recaptcha_targets.indexOf("signup") > -1) {
|
||||
return true;
|
||||
}
|
||||
if (act.match(/^procMemberLogin$/i) && recaptcha_targets.indexOf("login") > -1) {
|
||||
return true;
|
||||
}
|
||||
if (act.match(/^procMember(FindAccount|ResendAuthMail)$/i) && recaptcha_targets.indexOf("recovery") > -1) {
|
||||
return true;
|
||||
}
|
||||
if (act.match(/^proc[A-Z][a-zA-Z0-9_]+InsertDocument$/i) && recaptcha_targets.indexOf("document") > -1) {
|
||||
return true;
|
||||
}
|
||||
if (act.match(/^proc[A-Z][a-zA-Z0-9_]+InsertComment$/i) && recaptcha_targets.indexOf("comment") > -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
var procfilter = $(this).attr("onsubmit");
|
||||
if (procfilter && procfilter.match(/procFilter\b.+\binsert/i)) {
|
||||
if (procfilter && procfilter.match(/procFilter\b.+\binsert/i) && (recaptcha_targets.indexOf("document") > -1 || recaptcha_targets.indexOf("comment") > -1)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue