fix POST requests to DELETE and PUT and fix double-free password in change_user.c
This commit is contained in:
1 parent
9c3a8d796a
commit
7d04b0078f
12 files changed
+57
-35
No files matched your search
+2
-2
@@ -6,7 +6,7 @@ void get_user(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
request_with_token *requestdata = check_body(hm);
|
||||
if (!jwt_verifyJWT(requestdata->token, JWT_DEFAULT_SECRET)) {
|
||||
free_request_with_token(requestdata);
|
||||
mg_http_reply(c, 403, "", "{%m:%m}", MG_ESC("error"),
|
||||
mg_http_reply(c, 403, "Content-Type: application/json\r\n", "{%m:%m}", MG_ESC("error"),
|
||||
MG_ESC("invalid token"));
|
||||
return;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ void get_user(struct mg_connection *c, struct mg_http_message *hm) {
|
||||
free_request_with_token(requestdata);
|
||||
cJSON_Delete(payload);
|
||||
free(username);
|
||||
mg_http_reply(c, 404, "", "{%m:%m}", MG_ESC("error"),
|
||||
mg_http_reply(c, 404, "Content-Type: application/json\r\n", "{%m:%m}", MG_ESC("error"),
|
||||
MG_ESC("user not found"));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user