From 6959b2e816c28fb782a748f12f671629208e045d Mon Sep 17 00:00:00 2001 From: Tim Schuster Date: Wed, 22 Apr 2020 07:26:29 +0200 Subject: [PATCH] ignore captcha when creatig new reply --- http/board/newreply.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/http/board/newreply.go b/http/board/newreply.go index 774f963..2839dc2 100644 --- a/http/board/newreply.go +++ b/http/board/newreply.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/pressly/chi" "github.com/tidwall/buntdb" + "go.rls.moe/nyx/config" "go.rls.moe/nyx/http/errw" "go.rls.moe/nyx/http/middle" "go.rls.moe/nyx/resources" @@ -24,12 +25,14 @@ func handleNewReply(w http.ResponseWriter, r *http.Request) { return } - if !resources.VerifyCaptcha(r) { - http.Redirect(w, r, - fmt.Sprintf("/%s/%s/thread.html?err=wrong_captcha", - chi.URLParam(r, "board"), chi.URLParam(r, "thread")), - http.StatusSeeOther) - return + if middle.GetConfig(r).Captcha.Mode != config.CaptchaDisabled { + if !resources.VerifyCaptcha(r) { + http.Redirect(w, r, + fmt.Sprintf("/%s/%s/thread.html?err=wrong_captcha", + chi.URLParam(r, "board"), chi.URLParam(r, "thread")), + http.StatusSeeOther) + return + } } var reply = &resources.Reply{}