Added the DisableJSAntispam config.json setting.
This commit is contained in:
parent
c15f02396a
commit
218070fceb
|
@ -82,6 +82,7 @@ type config struct {
|
||||||
ServerCount int
|
ServerCount int
|
||||||
|
|
||||||
DisableLiveTopicList bool
|
DisableLiveTopicList bool
|
||||||
|
DisableJSAntispam bool
|
||||||
|
|
||||||
Noavatar string // ? - Move this into the settings table?
|
Noavatar string // ? - Move this into the settings table?
|
||||||
ItemsPerPage int // ? - Move this into the settings table?
|
ItemsPerPage int // ? - Move this into the settings table?
|
||||||
|
|
|
@ -240,12 +240,14 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U
|
||||||
if r.PostFormValue("tos") != "0" {
|
if r.PostFormValue("tos") != "0" {
|
||||||
regError(common.GetErrorPhrase("register_might_be_machine"), "trap-question")
|
regError(common.GetErrorPhrase("register_might_be_machine"), "trap-question")
|
||||||
}
|
}
|
||||||
|
if !common.Config.DisableJSAntispam {
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
h.Write([]byte(common.JSTokenBox.Load().(string)))
|
h.Write([]byte(common.JSTokenBox.Load().(string)))
|
||||||
h.Write([]byte(user.LastIP))
|
h.Write([]byte(user.LastIP))
|
||||||
if r.PostFormValue("golden-watch") != hex.EncodeToString(h.Sum(nil)) {
|
if r.PostFormValue("golden-watch") != hex.EncodeToString(h.Sum(nil)) {
|
||||||
regError(common.GetErrorPhrase("register_might_be_machine"), "js-antispam")
|
regError(common.GetErrorPhrase("register_might_be_machine"), "js-antispam")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
username := common.SanitiseSingleLine(r.PostFormValue("username"))
|
username := common.SanitiseSingleLine(r.PostFormValue("username"))
|
||||||
// TODO: Add a dedicated function for validating emails
|
// TODO: Add a dedicated function for validating emails
|
||||||
|
|
Loading…
Reference in New Issue