diff --git a/src/app/http/controllers/Home.controller.ts b/src/app/http/controllers/Home.controller.ts index a2b3085..ec5bfa8 100644 --- a/src/app/http/controllers/Home.controller.ts +++ b/src/app/http/controllers/Home.controller.ts @@ -112,6 +112,12 @@ export class Home extends Controller { } async contact(data: Valid) { + // If the request has an "e-mail" field, then this was likely filled out by a spam + // bot, as this field is hidden on the form. So, reject it. + if ( this.request.input('e-mail') ) { + data.name = `SPAM: ${data.name}` // for testing, just alter the name + } + const submission = make(ContactSubmission) submission.name = data.name submission.email = data.email diff --git a/src/app/resources/views/welcome.pug b/src/app/resources/views/welcome.pug index e7fb22c..27b1779 100644 --- a/src/app/resources/views/welcome.pug +++ b/src/app/resources/views/welcome.pug @@ -43,6 +43,7 @@ block content form#contact-form(method='post' action=named('contact')) .form-group input#contactEmail.form-control(type='email' name='email' placeholder='E-Mail Address' required) + input#contactEEmail(type='email' name='e-mail') .form-group input#contactFirst.form-control(name='name' placeholder='Name' required) .form-group @@ -65,3 +66,7 @@ block content .row.mt-4 .col-12.text-center a.button(href="/feed") view all + +block append script + script. + document.getElementById('contactEEmail').style.display = 'none'