commit f1327ef59d75088498ae1960ef072a52291de25c
parent 40ec85171fcbac5e5e81febc5a19ac0774fcad2e
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 9 Nov 2022 19:47:26 -0800
fuck a bit more with trolls
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -3686,6 +3686,14 @@ func CaptchaRequiredHandler(c echo.Context) error {
config.CaptchaRequiredFailed.Inc()
return c.Render(http.StatusOK, "captcha-required", data)
}
+ // HB has 50% chance of having the captcha fails for no reason
+ hbCookie, hbCookieErr := c.Cookie(hutils.HBCookieName)
+ hasHBCookie := hbCookieErr == nil && hbCookie.Value != ""
+ if hasHBCookie && utils.DiceRoll(50) {
+ data.ErrCaptcha = fmt.Sprintf("Invalid answer")
+ config.CaptchaRequiredFailed.Inc()
+ return c.Render(http.StatusOK, "captcha-required", data)
+ }
config.CaptchaRequiredSuccess.Inc()
authUser.CaptchaRequired = false
authUser.DoSave()