develop #3

Merged
wt merged 21 commits from develop into main 2025-10-23 07:20:44 +00:00
Showing only changes of commit b986ab6b0d - Show all commits
+2 -4
View File
@@ -5,14 +5,12 @@
void verify_token(struct mg_connection *c, struct mg_http_message *hm) {
request_with_token *data = check_body(hm);
if (data->error != nullptr) {
mg_http_reply(c, 403, HTTP_HEADERS, "{%m:%m}", MG_ESC("error"),
MG_ESC(data->error));
mg_http_reply(c, 403, HTTP_HEADERS, "{%m:false}", MG_ESC("valid"));
return;
}
const bool valid = jwt_verifyJWT(data->token, JWT_DEFAULT_SECRET);
if (!valid) {
mg_http_reply(c, 403, HTTP_HEADERS, "{%m:%m}", MG_ESC("error"),
MG_ESC("invalid token"));
mg_http_reply(c, 403, HTTP_HEADERS, "{%m:false}", MG_ESC("valid"));
free_request_with_token(data);
return;
}