checkRecaptchaEnabled creates an error response if recaptcha is not usable on homeserver.
( cfg *config.ClientAPI, w http.ResponseWriter, req *http.Request, )
| 181 | |
| 182 | // checkRecaptchaEnabled creates an error response if recaptcha is not usable on homeserver. |
| 183 | func checkRecaptchaEnabled( |
| 184 | cfg *config.ClientAPI, |
| 185 | w http.ResponseWriter, |
| 186 | req *http.Request, |
| 187 | ) *util.JSONResponse { |
| 188 | if !cfg.RecaptchaEnabled { |
| 189 | return writeHTTPMessage(w, req, |
| 190 | "Recaptcha login is disabled on this Homeserver", |
| 191 | http.StatusBadRequest, |
| 192 | ) |
| 193 | } |
| 194 | return nil |
| 195 | } |
| 196 | |
| 197 | // writeHTTPMessage writes the given header and message to the HTTP response writer. |
| 198 | // Returns an error JSONResponse obtained through httputil.LogThenError if the writing failed, otherwise nil. |
no test coverage detected