deleted stringstream
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
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:
1 parent
427444890b
commit
a89d0e33e4
5 files changed
+18
-24
No files matched your search
@@ -94,14 +94,12 @@ void add_user(const httplib::Request& request, httplib::Response& response)
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream new_user_data;
|
||||
|
||||
new_user_data << R"({"id":")" << get_random_string(ALPHABET, 50) << R"(","username":")"
|
||||
<< username << R"(","password":")" << password << R"(","group":)";
|
||||
(json_body["group"] != nullptr) ? new_user_data << json_body["group"] : new_user_data << "\"users\"";
|
||||
new_user_data << ",\"is_superuser\":";
|
||||
(json_body["is_superuser"] != nullptr) ? new_user_data << json_body["is_superuser"] : new_user_data << "\"0\"";
|
||||
new_user_data << "}";
|
||||
std::string new_user_data;
|
||||
new_user_data += R"({"id":")" + get_random_string(ALPHABET, 50) + R"(","username":")" + username + R"(","password":")" + password + R"(","group":)";
|
||||
(json_body["group"] != nullptr) ? new_user_data += R"(")" + std::string(json_body["group"]) + R"(")" : new_user_data += R"("users")";
|
||||
new_user_data += ",\"is_superuser\":";
|
||||
(json_body["is_superuser"] != nullptr) ? new_user_data += R"(")" + std::string(json_body["is_superuser"]) + R"(")" : new_user_data += "\"0\"";
|
||||
new_user_data += "}";
|
||||
all_users.push_back(nlohmann::json::parse(new_user_data));
|
||||
|
||||
std::ofstream usersfilew(USERS_FILE);
|
||||
|
||||
Reference in new issue
Block a user