mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
feat: add captcha check
This commit is contained in:
parent
8ec262f09c
commit
19a2c02e9a
@ -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]
|
||||||
|
Loading…
Reference in New Issue
Block a user