Added the DisableJSAntispam config.json setting.

This commit is contained in:
Azareal 2018-10-16 20:02:51 +10:00
parent c15f02396a
commit 218070fceb
2 changed files with 8 additions and 5 deletions

View File

@ -82,6 +82,7 @@ type config struct {
ServerCount int
DisableLiveTopicList bool
DisableJSAntispam bool
Noavatar string // ? - Move this into the settings table?
ItemsPerPage int // ? - Move this into the settings table?

View File

@ -240,11 +240,13 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U
if r.PostFormValue("tos") != "0" {
regError(common.GetErrorPhrase("register_might_be_machine"), "trap-question")
}
h := sha256.New()
h.Write([]byte(common.JSTokenBox.Load().(string)))
h.Write([]byte(user.LastIP))
if r.PostFormValue("golden-watch") != hex.EncodeToString(h.Sum(nil)) {
regError(common.GetErrorPhrase("register_might_be_machine"), "js-antispam")
if !common.Config.DisableJSAntispam {
h := sha256.New()
h.Write([]byte(common.JSTokenBox.Load().(string)))
h.Write([]byte(user.LastIP))
if r.PostFormValue("golden-watch") != hex.EncodeToString(h.Sum(nil)) {
regError(common.GetErrorPhrase("register_might_be_machine"), "js-antispam")
}
}
username := common.SanitiseSingleLine(r.PostFormValue("username"))