added filtering for bot known bot subject and textarea
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 49s
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 49s
This commit is contained in:
parent
8445bb23ab
commit
7de49d32d3
2 changed files with 10 additions and 2 deletions
|
|
@ -41,6 +41,11 @@ const textInputs = document.querySelectorAll('input[type="text"]')
|
||||||
const captcha = document.querySelectorAll('.captcha')
|
const captcha = document.querySelectorAll('.captcha')
|
||||||
const captchaInput = document.querySelectorAll('.captcha-input')
|
const captchaInput = document.querySelectorAll('.captcha-input')
|
||||||
const captchaVerifyButton = document.querySelectorAll('.captcha-verify')
|
const captchaVerifyButton = document.querySelectorAll('.captcha-verify')
|
||||||
|
|
||||||
|
// Form fields
|
||||||
|
const subjectField = document.getElementById('subject')
|
||||||
|
const messageField = document.getElementById('description')
|
||||||
|
|
||||||
const botBadge = document.createElement('div')
|
const botBadge = document.createElement('div')
|
||||||
if (debugEnabled) {
|
if (debugEnabled) {
|
||||||
botBadge.className = 'bot-badge'
|
botBadge.className = 'bot-badge'
|
||||||
|
|
@ -112,6 +117,9 @@ function validateZSRNumber(form) {
|
||||||
function checkForBotBehavior() {
|
function checkForBotBehavior() {
|
||||||
let timeSpent = (Date.now() - startTime) / 1000
|
let timeSpent = (Date.now() - startTime) / 1000
|
||||||
botDetected =
|
botDetected =
|
||||||
|
subjectField.value === "I promised." ||
|
||||||
|
// or if messageField Has string "Hi, this is" in it
|
||||||
|
messageField.value.startsWith("Hi, this is") ||
|
||||||
!userInteracted ||
|
!userInteracted ||
|
||||||
interactionCount === 0 ||
|
interactionCount === 0 ||
|
||||||
timeSpent < interactionThreshold ||
|
timeSpent < interactionThreshold ||
|
||||||
|
|
@ -176,7 +184,7 @@ function handleSubmit(e) {
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
submitButton.disabled = true
|
submitButton.disabled = true
|
||||||
submitButton.innerHTML = `
|
submitButton.innerHTML = `
|
||||||
<svg class="svg-spin" fill="#ffffff" width="30px" height="30px" viewBox="0 0 9.6 9.6" id="Flat" xmlns="http://www.w3.org/2000/svg"><path d="M5.1 1.2v1.2a0.3 0.3 0 0 1 -0.6 0V1.2a0.3 0.3 0 0 1 0.6 0m3.3 3.3h-1.2a0.3 0.3 0 0 0 0 0.6h1.2a0.3 0.3 0 0 0 0 -0.6m-1.691 1.785a0.3 0.3 0 0 0 -0.424 0.424l0.849 0.849a0.3 0.3 0 1 0 0.424 -0.424ZM4.8 6.9a0.3 0.3 0 0 0 -0.3 0.3v1.2a0.3 0.3 0 0 0 0.6 0v-1.2a0.3 0.3 0 0 0 -0.3 -0.3m-1.909 -0.615L2.042 7.133a0.3 0.3 0 0 0 0.424 0.424l0.849 -0.849a0.3 0.3 0 0 0 -0.424 -0.424M2.7 4.8a0.3 0.3 0 0 0 -0.3 -0.3H1.2a0.3 0.3 0 0 0 0 0.6h1.2a0.3 0.3 0 0 0 0.3 -0.3m-0.233 -2.758a0.3 0.3 0 0 0 -0.424 0.424l0.849 0.849a0.3 0.3 0 0 0 0.424 -0.424Z"/></svg>
|
<svg class="svg-spin" fill="#ffffff" width="30px" height="30px" viewBox="0 0 9.6 9.6" id="Flat" xmlns="http://www.w3.org/2000/svg"><path d="M5.1 1.2v1.2a0.3 0.3 0 0 1 -0.6 0V1.2a0.3 0.3 0 0 1 0.6 0m3.3 3.3h-1.2a0.3 0.3 0 0 0 0 0.6h1.2a0.3 0.3 0 0 0 0 -0.6m-1.691 1.785a0.3 0.3 0 0 0 -0.424 0.424l0.849 0.849a0.3 0.3 0 1 0 0.424 -0.424ZM4.8 6.9a0.3 0.3 0 0 0 -0.3 0.3v1.2a0.3 0.3 0 0 0 0.6 0v-1.2a0.3 0.3 0 0 0 -0.3 -0.3m-1.909 -0.615L2.042 7.133a0.3 0.3 0 0 0 0.424 0.424l0.849 -0.849a0.3 0.3 0 0 0 -0.424 -0.424M2.7 4.8a0.3 0.3 0 0 0 -0.3 -0.3H1.2a0.3 0.3 0 0 0 0 0.6h1.2a0.3 0.3 0 0 0 0.3 -0.3m-0.233 -2.758a0.3 0.3 0 0 0 -0.424 0.424l0.849 0.849a0.3 0.3 0 0 0 0.424 -0.424Z"/></svg>
|
||||||
`
|
`
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Configuration and Messages
|
// Configuration and Messages
|
||||||
const debugEnabled = true
|
const debugEnabled = false
|
||||||
const mouseDebugEnabled = false
|
const mouseDebugEnabled = false
|
||||||
const zsrCheckEnabled = false
|
const zsrCheckEnabled = false
|
||||||
const interactionThreshold = 15 // Time in seconds
|
const interactionThreshold = 15 // Time in seconds
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue