show status, error when captcha required

This commit is contained in:
ouwou
2023-07-01 02:10:42 -04:00
parent 044e508df7
commit ab448a3a98
6 changed files with 106 additions and 2 deletions

View File

@@ -1206,6 +1206,13 @@ void DiscordClient::RemoteAuthLogin(const std::string &ticket, const sigc::slot<
if (CheckCode(r)) {
callback(nlohmann::json::parse(r.text).at("encrypted_token").get<std::string>(), DiscordError::NONE);
} else {
try {
const auto j = nlohmann::json::parse(r.text);
if (j.contains("captcha_service")) {
callback(std::nullopt, DiscordError::CAPTCHA_REQUIRED);
return;
}
} catch (...) {}
callback(std::nullopt, GetCodeFromResponse(r));
}
});