mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Added error status codes
This commit is contained in:
parent
0973dfc4d6
commit
bf99e3677b
|
|
@ -109,6 +109,7 @@ func AuthFallback(
|
||||||
sessionID := req.URL.Query().Get("session")
|
sessionID := req.URL.Query().Get("session")
|
||||||
|
|
||||||
if sessionID == "" {
|
if sessionID == "" {
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
_, err := w.Write([]byte("Session ID not provided"))
|
_, err := w.Write([]byte("Session ID not provided"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res := httputil.LogThenError(req, err)
|
res := httputil.LogThenError(req, err)
|
||||||
|
|
@ -135,6 +136,7 @@ func AuthFallback(
|
||||||
// Handle Recaptcha
|
// Handle Recaptcha
|
||||||
if authType == authtypes.LoginTypeRecaptcha {
|
if authType == authtypes.LoginTypeRecaptcha {
|
||||||
if cfg.Matrix.RecaptchaPublicKey == "" {
|
if cfg.Matrix.RecaptchaPublicKey == "" {
|
||||||
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
_, err := w.Write([]byte("This Homeserver doesn't have a recaptcha public key"))
|
_, err := w.Write([]byte("This Homeserver doesn't have a recaptcha public key"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res := httputil.LogThenError(req, err)
|
res := httputil.LogThenError(req, err)
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ func Setup(
|
||||||
vars := mux.Vars(req)
|
vars := mux.Vars(req)
|
||||||
return AuthFallback(w, req, vars["authType"], cfg)
|
return AuthFallback(w, req, vars["authType"], cfg)
|
||||||
}),
|
}),
|
||||||
).Methods("GET", "POST", "OPTIONS")
|
).Methods(http.MethodGet, http.MethodPost, http.MethodOptions)
|
||||||
|
|
||||||
r0mux.Handle("/pushrules/",
|
r0mux.Handle("/pushrules/",
|
||||||
common.MakeExternalAPI("push_rules", func(req *http.Request) util.JSONResponse {
|
common.MakeExternalAPI("push_rules", func(req *http.Request) util.JSONResponse {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue