Compare commits

...

7 commits

Author SHA1 Message Date
72bdab6785 added Verua email to order form
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 50s
2024-05-13 12:38:59 +02:00
5c401526bb fixed bestellformular
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 50s
2024-05-13 12:17:54 +02:00
304c20e618 setup method to handle logs of submissions 2024-05-13 12:13:24 +02:00
7de49d32d3 added filtering for bot known bot subject and textarea
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 49s
2024-05-13 11:22:26 +02:00
8445bb23ab added current branch to build
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 51s
2024-05-13 11:09:36 +02:00
af62a449e6 added filter for curren spam mails 2024-05-13 11:07:05 +02:00
35ee0eeb4b removed @ sign from emails 2024-05-13 10:01:04 +02:00
6 changed files with 50 additions and 13 deletions

View file

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- main - main
- kontaktformular-filter-spam
jobs: jobs:
buildAndDeploy: buildAndDeploy:

View file

@ -41,6 +41,9 @@ 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 botBadge = document.createElement('div') const botBadge = document.createElement('div')
if (debugEnabled) { if (debugEnabled) {
botBadge.className = 'bot-badge' botBadge.className = 'bot-badge'
@ -176,7 +179,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(() => {

View file

@ -43,6 +43,11 @@ 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')
const botBadge = document.createElement('div') const botBadge = document.createElement('div')
// Form fields
const subjectField = document.getElementById('subject')
const messageField = document.getElementById('description')
if (debugEnabled) { if (debugEnabled) {
botBadge.className = 'bot-badge' botBadge.className = 'bot-badge'
document.body.appendChild(botBadge) document.body.appendChild(botBadge)
@ -102,6 +107,9 @@ function handleMouseMove(event) {
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 ||
honeypotInput1.value !== '' || honeypotInput1.value !== '' ||
@ -131,9 +139,33 @@ function checkForBotBehavior() {
' honeypotInput2:' + ' honeypotInput2:' +
honeypotInput2.value + honeypotInput2.value +
' verifyEmailInput:' + ' verifyEmailInput:' +
verifyEmailInput.value verifyEmailInput.value +
' subjectField:' +
subjectField.value +
' messageField:' +
messageField.value
) )
} }
// function logSubmission() {
// console.log('in logSubmission()')
// const data = { logData: 'Hi, this is some log data from JavaScript.' }
// fetch('/php/log.php', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// },
// body: JSON.stringify(data),
// })
// .then((response) => response.json())
// .then((data) => {
// console.log('Success:', data)
// })
// .catch((error) => {
// console.error('Error:', error)
// })
// }
//
function handleSubmit(e) { function handleSubmit(e) {
e.preventDefault() e.preventDefault()
@ -144,11 +176,14 @@ function handleSubmit(e) {
fakeOut() fakeOut()
return false return false
} }
const formData = new FormData(form) const formData = new FormData(form)
const formDataEncoded = new URLSearchParams(formData).toString() const formDataEncoded = new URLSearchParams(formData).toString()
const formURL = form.action + '.json' const formURL = form.action + '.json'
// logSubmission()
// fakeOut()
// return false
fetch(formURL, { fetch(formURL, {
method: 'POST', method: 'POST',
headers: { headers: {
@ -164,7 +199,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(() => {
@ -189,7 +224,7 @@ function handleSubmit(e) {
} }
function fakeOut() { function fakeOut() {
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(() => {

View file

@ -21,7 +21,7 @@ CH-8253 Diessenhofen
079 393 86 83 079 393 86 83
support@verua.ch support"at"verua.ch
&nbsp; &nbsp;
&nbsp; &nbsp;

View file

@ -19,7 +19,7 @@ CH-8253 Diessenhofen
079 393 86 83 079 393 86 83
support@verua.ch support"at"verua.ch
&nbsp; &nbsp;
&nbsp; &nbsp;
@ -42,4 +42,4 @@ support@verua.ch
{{% /columns %}} {{% /columns %}}
{{% /aligncenter %}} {{% /aligncenter %}}

View file

@ -27,7 +27,7 @@ try {
// Es handelt sich wahrscheinlich um einen Bot // Es handelt sich wahrscheinlich um einen Bot
$subject = 'Botverdacht - ' . $subject; $subject = 'Botverdacht - ' . $subject;
} }
if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message)) { if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message)) {
// Invalid input // Invalid input
throw new Exception('Ungültige Eingabedaten.'); throw new Exception('Ungültige Eingabedaten.');
@ -44,11 +44,9 @@ try {
$mail->Port = 465; // TCP port for the connection $mail->Port = 465; // TCP port for the connection
// Recipients // Recipients
$mail->setFrom($email, $name); // Sender address $mail->setFrom('support@verua.ch', 'Verua Support'); // Sender address
$mail->addAddress('ah@mediendesign-hnida.de', 'Andreas Hnida'); // Add recipient $mail->addAddress('ah@mediendesign-hnida.de', 'Andreas Hnida'); // Add recipient
// $mail->addAddress('bettina.rasberger@rabe-web.ch', 'Bettina Rasberger'); // Add another recipient $mail->addAddress('support@verua.ch', 'Verua Support'); // Add another recipient
// $mail->addAddress('norbert.wagner@verua.ch'); // Add another recipient
$mail->addReplyTo($email, $name); // Set reply address
$mail->addBCC('ah@mediendesign-hnida.de'); // Add bounce email address as BCC $mail->addBCC('ah@mediendesign-hnida.de'); // Add bounce email address as BCC
// Content // Content