Optimise reCaptcha for multiple reCaptcha page
This commit is contained in:
parent
0edafd6be2
commit
4cc884d03b
3 changed files with 13 additions and 13 deletions
|
@ -21,3 +21,14 @@ dark.addEventListener("click", () => {
|
||||||
else
|
else
|
||||||
contact.classList.add("hide");
|
contact.classList.add("hide");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function cb(token) {
|
||||||
|
document.querySelectorAll("div.recaptcha.recaptcha-cb").forEach(el => {
|
||||||
|
el.classList.remove("recaptcha-cb");
|
||||||
|
let input = document.createElement("input");
|
||||||
|
input.setAttribute("type", "hidden");
|
||||||
|
input.setAttribute("name", "g-recaptcha-response");
|
||||||
|
input.setAttribute("value", token);
|
||||||
|
el.appendChild(input);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -91,3 +91,5 @@ html
|
||||||
+submit(value=__("layout.send"))
|
+submit(value=__("layout.send"))
|
||||||
|
|
||||||
script(src="/javascripts/layout.js")
|
script(src="/javascripts/layout.js")
|
||||||
|
if !test
|
||||||
|
p !{captcha}
|
||||||
|
|
|
@ -1,16 +1,3 @@
|
||||||
mixin submit(value)
|
mixin submit(value)
|
||||||
div.recaptcha.recaptcha-cb
|
div.recaptcha.recaptcha-cb
|
||||||
input(type="submit" value!=value)
|
input(type="submit" value!=value)
|
||||||
if !test
|
|
||||||
p !{captcha}
|
|
||||||
script.
|
|
||||||
function cb(token) {
|
|
||||||
document.querySelectorAll("div.recaptcha.recaptcha-cb").forEach(el => {
|
|
||||||
el.classList.remove("recaptcha-cb");
|
|
||||||
let input = document.createElement("input");
|
|
||||||
input.setAttribute("type", "hidden");
|
|
||||||
input.setAttribute("name", "g-recaptcha-response");
|
|
||||||
input.setAttribute("value", token);
|
|
||||||
el.appendChild(input);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
Reference in a new issue