0
0
mirror of https://github.com/rls-moe/nyx synced 2024-11-14 22:12:24 +00:00

ignore captcha when creatig new thread

This commit is contained in:
Tim Schuster 2020-04-22 07:24:13 +02:00
parent a3f8fe4db0
commit dea4148f4b

View File

@ -2,12 +2,14 @@ package board
import ( import (
"fmt" "fmt"
"net/http"
"github.com/pressly/chi" "github.com/pressly/chi"
"github.com/tidwall/buntdb" "github.com/tidwall/buntdb"
"go.rls.moe/nyx/config"
"go.rls.moe/nyx/http/errw" "go.rls.moe/nyx/http/errw"
"go.rls.moe/nyx/http/middle" "go.rls.moe/nyx/http/middle"
"go.rls.moe/nyx/resources" "go.rls.moe/nyx/resources"
"net/http"
) )
func handleNewThread(w http.ResponseWriter, r *http.Request) { func handleNewThread(w http.ResponseWriter, r *http.Request) {
@ -22,6 +24,7 @@ func handleNewThread(w http.ResponseWriter, r *http.Request) {
return return
} }
if middle.GetConfig(r).Captcha.Mode != config.CaptchaDisabled {
if !resources.VerifyCaptcha(r) { if !resources.VerifyCaptcha(r) {
http.Redirect(w, r, http.Redirect(w, r,
fmt.Sprintf("/%s/board.html?err=wrong_captcha", fmt.Sprintf("/%s/board.html?err=wrong_captcha",
@ -29,6 +32,7 @@ func handleNewThread(w http.ResponseWriter, r *http.Request) {
http.StatusSeeOther) http.StatusSeeOther)
return return
} }
}
var thread = &resources.Thread{} var thread = &resources.Thread{}
var mainReply = &resources.Reply{} var mainReply = &resources.Reply{}