updated and added more funcs to be small
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled

This commit is contained in:
wt committed 2025-04-19 16:41:19 +07:00
1 parent 55ccf5b2f6
commit 794ada3d10
11 files changed
+72 -197

No files matched your search

+3 -20
View File
@@ -14,27 +14,10 @@ namespace AuthService
{
std::cout << GREEN << request.path << RESET << " " << request.method << std::endl;
response.set_header("Access-Control-Allow-Origin", "*");
if (request.body.empty()) {
response.set_content(
DELETE_USER_REQUIRED_STRING,
JSON_TYPE);
syslog(LOG_ERR, "delete user request body is empty");
return;
}
AuthService::Includes::check_body_empty(request, response, DELETE_USER_REQUIRED_STRING);
nlohmann::json json_body = nlohmann::json::parse(request.body);
if (json_body["token"] == nullptr) {
response.set_content(
DELETE_USER_REQUIRED_STRING,
JSON_TYPE);
syslog(LOG_ERR, "no token in delete user request");
return;
}
if (!AuthService::Auth::verify_auth(json_body["token"])) {
response.set_content(STRING403, JSON_TYPE);
syslog(LOG_ERR, "access reject in delete user request");
return;
}
AuthService::Includes::check_body_data(json_body, "token", response, DELETE_USER_REQUIRED_STRING);
AuthService::Auth::verify_auth(json_body["token"], response);
std::string userid = JWT::get_payload(json_body["token"], JWT_SECRET_KEY)["userId"];
if (userid.empty()) {