Skip to content
Permalink
Browse files

email is now encoded on emailrequest

  • Loading branch information...
Turupawn committed May 28, 2019
1 parent 1556ba2 commit 502f0d796352480e7e699c1dc0c233ddea92d62e
Showing with 13 additions and 2 deletions.
  1. +1 −0 include/wrappers/CurlUtility.h
  2. +2 −2 src/c/methods/AuthenticationMethods.cpp
  3. +10 −0 src/wrappers/CurlUtility.cpp
@@ -122,6 +122,7 @@ std::string multimapDataToUrlString(std::multimap<std::string, std::string> data

void setupCurrentModDownload(CurrentModDownload *current_mod_download, u32 mod_id);
void handleOnGetDownloadModError(ModioMod* modio_mod);
std::string dataURLEncode(std::string data);

} // namespace curlwrapper
} // namespace modio
@@ -14,9 +14,9 @@ extern "C"

std::string url = modio::MODIO_URL + modio::MODIO_VERSION_PATH + "oauth/emailrequest";
url += "?api_key=" + modio::API_KEY;
url += "&email=" + std::string(email);
url += "&email=" + modio::curlwrapper::dataURLEncode(std::string(email));

modio::curlwrapper::post(call_number, url, std::vector<std::string>(), data, &modioOnEmailRequested);
modio::curlwrapper::post(call_number, url, modio::getUrlEncodedHeaders(), data, &modioOnEmailRequested);
}

void modioEmailExchange(void* object, char const* security_code, void (*callback)(void* object, ModioResponse response))
@@ -270,5 +270,15 @@ void handleOnGetDownloadModError(ModioMod* modio_mod)
modioFreeMod(modio_mod);
}

std::string dataURLEncode(std::string data)
{
char *output = curl_easy_escape(NULL, data.c_str(), data.length());
if(output) {
data = std::string(output);
curl_free(output);
}
return data;
}

} // namespace curlwrapper
} // namespace modio

0 comments on commit 502f0d7

Please sign in to comment.
You can’t perform that action at this time.