form: fix captcha

wouldn't compile (not sure why i didn't notice) and after fixing, the
check was being performed after deleting the invite so would always
fail.
This commit is contained in:
Harvey Tindall
2022-01-13 20:40:58 +00:00
parent d9f8785372
commit 1c942186aa
4 changed files with 13 additions and 8 deletions
+2
View File
@@ -323,10 +323,12 @@ func (app *appContext) GenCaptcha(gc *gin.Context) {
func (app *appContext) verifyCaptcha(code, id, text string) bool {
inv, ok := app.storage.invites[code]
if !ok || inv.Captchas == nil {
app.debug.Printf("Couldn't find invite \"%s\"", code)
return false
}
c, ok := inv.Captchas[id]
if !ok {
app.debug.Printf("Couldn't find Captcha \"%s\"", id)
return false
}
return strings.ToLower(c.Text) == strings.ToLower(text)