Skip to content

Commit

Permalink
fix: filter message for with empty "nachricht" field 🍵
Browse files Browse the repository at this point in the history
  • Loading branch information
johanngyger committed Dec 23, 2022
1 parent 7aef6ff commit c71428f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func validateForm(req *http.Request, isNewsletter bool) error {
return fmt.Errorf("required form field email is empty, which is probably spam")
}

if k == "nachricht" && v == "" {
return fmt.Errorf("main message field is empty, which is probably spam")
}

if strings.Contains(v, "http") {
return fmt.Errorf("form field %v contains a link, which is probably spam", k)
}
Expand Down

0 comments on commit c71428f

Please sign in to comment.