Catch spam bots on my contact form

pull/5/head
Noah 2018-05-01 18:26:50 +00:00
parent a1c84fa1e9
commit f154c55862
1 changed files with 6 additions and 0 deletions

View File

@ -38,5 +38,11 @@ func (c Contact) Validate() error {
if len(c.Message) == 0 {
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
}