Archived
1
0

try fixing captcha

This commit is contained in:
Jeff Becker 2019-02-19 08:45:10 -05:00
parent c1afacda17
commit 9d43d84926
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -407,10 +407,17 @@ func (self *httpFrontend) HandleNewPost(nntp frontendPost) {
// create a new captcha, return as json object
func (self *httpFrontend) new_captcha_json(wr http.ResponseWriter, r *http.Request) {
s, err := self.store.Get(r, self.name)
if err != nil {
http.Error(wr, err.Error(), 500)
return
}
captcha_id := captcha.New()
resp := make(map[string]string)
// the captcha id
resp["id"] = captcha_id
s.Values["captcha_id"] = captcha_id
s.Save(r, wr)
// url of the image
resp["url"] = fmt.Sprintf("%scaptcha/%s.png", self.prefix, captcha_id)
wr.Header().Set("Content-Type", "text/json; encoding=UTF-8")