diff --git a/.gitea/workflows/build-and-deploy-pipeline.yaml b/.gitea/workflows/build-and-deploy-pipeline.yaml index 7395958..d753ffe 100644 --- a/.gitea/workflows/build-and-deploy-pipeline.yaml +++ b/.gitea/workflows/build-and-deploy-pipeline.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - kontaktformular-filter-spam jobs: buildAndDeploy: diff --git a/assets/js/kontaktformular.js b/assets/js/kontaktformular.js index a3f63bf..606b3bc 100644 --- a/assets/js/kontaktformular.js +++ b/assets/js/kontaktformular.js @@ -1,5 +1,5 @@ // Configuration and Messages -const debugEnabled = false +const debugEnabled = true const mouseDebugEnabled = false const zsrCheckEnabled = false const interactionThreshold = 15 // Time in seconds @@ -43,6 +43,11 @@ const captcha = document.querySelectorAll('.captcha') const captchaInput = document.querySelectorAll('.captcha-input') const captchaVerifyButton = document.querySelectorAll('.captcha-verify') const botBadge = document.createElement('div') + +// Form fields +const subjectField = document.getElementById('subject') +const messageField = document.getElementById('description') + if (debugEnabled) { botBadge.className = 'bot-badge' document.body.appendChild(botBadge) @@ -102,6 +107,9 @@ function handleMouseMove(event) { function checkForBotBehavior() { let timeSpent = (Date.now() - startTime) / 1000 botDetected = + subjectField.value === "I promised." || +// or if messageField Has string "Hi, this is" in it + messageField.value.startsWith("Hi, this is") || !userInteracted || interactionCount === 0 || honeypotInput1.value !== '' || @@ -131,7 +139,11 @@ function checkForBotBehavior() { ' honeypotInput2:' + honeypotInput2.value + ' verifyEmailInput:' + - verifyEmailInput.value + verifyEmailInput.value + + ' subjectField:' + + subjectField.value + + ' messageField:' + + messageField.value ) } function handleSubmit(e) { @@ -144,7 +156,6 @@ function handleSubmit(e) { fakeOut() return false } - const formData = new FormData(form) const formDataEncoded = new URLSearchParams(formData).toString() const formURL = form.action + '.json' @@ -164,7 +175,7 @@ function handleSubmit(e) { }) .then((data) => { submitButton.disabled = true - submitButton.innerHTML = ` + submitButton.innerHTML = ` ` setTimeout(() => { @@ -189,7 +200,7 @@ function handleSubmit(e) { } function fakeOut() { submitButton.disabled = true - submitButton.innerHTML = ` + submitButton.innerHTML = ` ` setTimeout(() => { diff --git a/content/french/sections/footer.md b/content/french/sections/footer.md index 68d110a..a975c16 100644 --- a/content/french/sections/footer.md +++ b/content/french/sections/footer.md @@ -21,7 +21,7 @@ CH-8253 Diessenhofen 079 393 86 83 -support@verua.ch +support"at"verua.ch     diff --git a/content/german/sections/footer.md b/content/german/sections/footer.md index 7d39497..799afc0 100644 --- a/content/german/sections/footer.md +++ b/content/german/sections/footer.md @@ -19,7 +19,7 @@ CH-8253 Diessenhofen 079 393 86 83 -support@verua.ch +support"at"verua.ch     @@ -42,4 +42,4 @@ support@verua.ch {{% /columns %}} -{{% /aligncenter %}} \ No newline at end of file +{{% /aligncenter %}}