adjusted spam filter to work for values around 20 characters, to stop spam of short proportions

This commit is contained in:
rawleyIfowler
2022-03-01 16:15:22 -06:00
parent ede5865307
commit cefeeec11a

View File

@@ -125,7 +125,8 @@ func CreateComment(c *gin.Context) {
c.Request.Form.Get("content"), c.Request.Form.Get("content"),
c.Request.Form.Get("url"), c.Request.Form.Get("url"),
c.Request.Form.Get("captcha")} c.Request.Form.Get("captcha")}
if len(a[1]) > 180 && len(*GetCommentsByContent(a[1], a[2])) > 0 { // If the length of the comment is great enough, and the comment already exists we can safely assume it is spam.
if len(a[1]) > 20 && len(*GetCommentsByContent(a[1], a[2])) > 0 {
c.HTML(http.StatusNotAcceptable, "comment_post_failed.tmpl", CommentDto{Url: a[2]}) c.HTML(http.StatusNotAcceptable, "comment_post_failed.tmpl", CommentDto{Url: a[2]})
return return
} }