fix: recaptcha fixes, auth fixes and line endings

* http: auth: remove unnecessary fields in recaptcha validation

* http: render: never expose ReCaptchaSecret to public

* build: dos2unix build.sh


Former-commit-id: 21908028289e4a5d30b5a2c1961abf163b1a93b6 [formerly b634e3e4da4a616119f6bc15ae92f15073f019fa] [formerly 55efca9d070539f346215090517abde1ec788be4 [formerly 9b8c2862e2]]
Former-commit-id: 70df1f0443977f6f2b101b946698dc3466aa6db9 [formerly 15195d4c28060aa1eca8f03ad0b77576ac8d9181]
Former-commit-id: e22d026e74a0cc800ad7281c35e4157037849e37
pull/726/head
Equim 2018-01-22 16:35:39 +08:00 committed by Henrique Dias
parent d50dc90a54
commit 6839c15a7b
3 changed files with 21 additions and 25 deletions

View File

@ -38,10 +38,7 @@ func reCaptcha(secret string, response string) (bool, error) {
}
var data struct {
Success bool `json:"success"`
ChallengeTS time.Time `json:"challenge_ts"`
Hostname string `json:"hostname"`
ErrorCodes interface{} `json:"error-codes"`
Success bool `json:"success"`
}
err = json.NewDecoder(resp.Body).Decode(&data)

View File

@ -223,13 +223,12 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
data := map[string]interface{}{
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fm.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
"ReCaptchaSecret": c.ReCaptchaSecret,
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fm.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
}
if c.StaticGen != nil {