feat: add captcha check

This commit is contained in:
Yanislav Igonin 2021-10-04 19:37:33 +03:00
parent 8ec262f09c
commit 19a2c02e9a

View File

@ -108,6 +108,15 @@ func CreateThread(c *gin.Context) {
return return
} }
captchaID := form.Value["captchaId"][0]
captchaString := form.Value["captcha"][0]
isCaptchaValid := captcha.VerifyString(captchaID, captchaString)
if !isCaptchaValid {
log.Println("error:", err)
c.HTML(http.StatusInternalServerError, "400.html", nil)
return
}
// TODO: dat shit crashes if no fields in request // TODO: dat shit crashes if no fields in request
text := form.Value["text"][0] text := form.Value["text"][0]
title := form.Value["title"][0] title := form.Value["title"][0]
@ -219,6 +228,15 @@ func UpdateThread(c *gin.Context) {
return return
} }
captchaID := form.Value["captchaId"][0]
captchaString := form.Value["captcha"][0]
isCaptchaValid := captcha.VerifyString(captchaID, captchaString)
if !isCaptchaValid {
log.Println("error:", err)
c.HTML(http.StatusInternalServerError, "400.html", nil)
return
}
// TODO: dat shit crashes if no fields in request // TODO: dat shit crashes if no fields in request
text := form.Value["text"][0] text := form.Value["text"][0]
// title := form.Value["title"][0] // title := form.Value["title"][0]