Add forgotten returns in case of error

This commit is contained in:
nxshock 2019-07-31 20:03:12 +05:00
parent e8165db50f
commit b87c860d7d

View File

@ -189,6 +189,7 @@ func JoinedRoomsHandler(w http.ResponseWriter, r *http.Request) {
token := getTokenFromResponse(r) token := getTokenFromResponse(r)
if token == "" { if token == "" {
errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "") errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "")
return
} }
user := currServer.Backend.GetUserByToken(token) user := currServer.Backend.GetUserByToken(token)
@ -217,6 +218,7 @@ func PasswordHandler(w http.ResponseWriter, r *http.Request) {
token := getTokenFromResponse(r) token := getTokenFromResponse(r)
if token == "" { if token == "" {
errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "") errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "")
return
} }
user := currServer.Backend.GetUserByToken(token) user := currServer.Backend.GetUserByToken(token)
@ -244,7 +246,6 @@ func SyncHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
request.Timeout = timeout request.Timeout = timeout
//log.Printf("%+v", request)
token := getTokenFromResponse(r) token := getTokenFromResponse(r)
if token == "" { if token == "" {
@ -270,6 +271,7 @@ func CapabilitiesHandler(w http.ResponseWriter, r *http.Request) {
token := getTokenFromResponse(r) token := getTokenFromResponse(r)
if token == "" { if token == "" {
errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "") errorResponse(w, models.M_FORBIDDEN, http.StatusForbidden, "")
return
} }
user := currServer.Backend.GetUserByToken(token) user := currServer.Backend.GetUserByToken(token)