Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/framework/net/httplogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,19 @@ void LoginHttp::httpLogin(const std::string& host, const std::string& path,
std::string msg = "";
if (result) {
status = result->status;
msg = httplib::to_string(result.error());
try {
const auto body = json::parse(result->body);
if (body.contains("errorMessage")) {
msg = body["errorMessage"];
} else {
msg = "Unexpected JSON format.";
}
} catch (const std::exception&) {
msg = httplib::to_string(result.error());
}
} else {
status = -1;
msg = "Unknown error";
msg = "Unknown error.\nCheck: \n-Enable Http login\n-Check Apache\n-Check login.php\n-check port 80/8080\n-Check Cloudflare";
}

g_dispatcher.addEvent([this, request_id, status, msg] {
Expand Down