diff options
| author | auth12 <[email protected]> | 2020-07-27 09:46:17 -0700 |
|---|---|---|
| committer | auth12 <[email protected]> | 2020-07-27 09:46:17 -0700 |
| commit | a2e89fde1acc5b189c55e0b8b38146194e455cd0 (patch) | |
| tree | 1f130027975733e0704a583aebb1a1832a22ec11 /server/src/forum/forum.cpp | |
| parent | Compile fix. (diff) | |
| download | loader-a2e89fde1acc5b189c55e0b8b38146194e455cd0.tar.xz loader-a2e89fde1acc5b189c55e0b8b38146194e455cd0.zip | |
Removed spdlog, using fmt wrapper instead.
More process class changes, support for 32/64bit processes.
Injection process improvements.
Other small changes.
Diffstat (limited to 'server/src/forum/forum.cpp')
| -rw-r--r-- | server/src/forum/forum.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/server/src/forum/forum.cpp b/server/src/forum/forum.cpp index a714cc6..e79f5e8 100644 --- a/server/src/forum/forum.cpp +++ b/server/src/forum/forum.cpp @@ -41,7 +41,7 @@ int xenforo_forum::check_login(const std::string_view username, auto json = nlohmann::json::parse(response); - if(!json.contains("user")) { + if (!json.contains("user")) { io::logger->error("json response for user {} doesn't contain user field.", username); return forum_response::api_fail; @@ -57,16 +57,30 @@ int xenforo_forum::check_login(const std::string_view username, auto custom_fields = user["custom_fields"]; + if(!user.contains("is_banned")) { + io::logger->error( + "json response for user {} doesn't contain is_banned.", username); + return forum_response::api_fail; + } + data.banned = user["is_banned"].get<bool>(); - // data.active = check user groupm - if (custom_fields.contains("hwid")) { - data.hwid = custom_fields["hwid"].get<std::string>(); - } else { - io::logger->warn("hwid field doesn't exist for {}.", username); + + if(!user.contains("user_id")) { + io::logger->error( + "json response for user {} doesn't contain user_id.", username); + return forum_response::api_fail; } data.id = user["user_id"].get<int>(); + if(!custom_fields.contains("hwid")) { + io::logger->error("custom fields for user {} dont contain hwid.", username); + return forum_response::api_fail; + } + + // data.active = check user group + data.hwid = custom_fields["hwid"].get<std::string>(); + return forum_response::api_success; } |