Catch spam bots on my contact form

This commit is contained in:
Noah 2018-05-01 18:26:50 +00:00
parent a1c84fa1e9
commit f154c55862

View File

@ -38,5 +38,11 @@ func (c Contact) Validate() error {
if len(c.Message) == 0 { if len(c.Message) == 0 {
return errors.New("message is required") return errors.New("message is required")
} }
// Spam bot traps.
if c.Trap1 != "" || c.Trap2 != "http://" {
return errors.New("message can't be delivered")
}
return nil return nil
} }