MCPcopy Create free account
hub / github.com/daodst/chat / checkRecaptchaEnabled

Function checkRecaptchaEnabled

clientapi/routing/auth_fallback.go:183–195  ·  view source on GitHub ↗

checkRecaptchaEnabled creates an error response if recaptcha is not usable on homeserver.

(
	cfg *config.ClientAPI,
	w http.ResponseWriter,
	req *http.Request,
)

Source from the content-addressed store, hash-verified

181
182// checkRecaptchaEnabled creates an error response if recaptcha is not usable on homeserver.
183func 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.

Callers 1

AuthFallbackFunction · 0.85

Calls 1

writeHTTPMessageFunction · 0.85

Tested by

no test coverage detected