Add spam honeypot to contact form on homepage
This commit is contained in:
parent
48edd7134f
commit
a3901b7d1e
@ -112,6 +112,12 @@ export class Home extends Controller {
|
||||
}
|
||||
|
||||
async contact(data: Valid<ContactForm>) {
|
||||
// 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>(ContactSubmission)
|
||||
submission.name = data.name
|
||||
submission.email = data.email
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user