This commit is contained in:
JustArchi
2017-01-17 18:25:38 +01:00
parent f3b53d3da2
commit 7792c8ffa7

View File

@@ -1294,13 +1294,12 @@ namespace ArchiSteamFarm {
Bot.ArchiLogger.LogGenericInfo(Strings.UnlockingParentalAccount);
const string request = SteamCommunityURL + "/parental/ajaxunlock";
Dictionary<string, string> data = new Dictionary<string, string>(1) {
{ "pin", parentalPin }
};
if (!await UnlockParentalCommunityAccount(parentalPin).ConfigureAwait(false)) {
Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed);
return false;
}
bool result = await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false);
if (!result) {
if (!await UnlockParentalStoreAccount(parentalPin).ConfigureAwait(false)) {
Bot.ArchiLogger.LogGenericWarning(Strings.WarningFailed);
return false;
}
@@ -1309,6 +1308,34 @@ namespace ArchiSteamFarm {
return true;
}
private async Task<bool> UnlockParentalCommunityAccount(string parentalPin) {
if (string.IsNullOrEmpty(parentalPin)) {
Bot.ArchiLogger.LogNullError(nameof(parentalPin));
return false;
}
const string request = SteamCommunityURL + "/parental/ajaxunlock";
Dictionary<string, string> data = new Dictionary<string, string>(1) {
{ "pin", parentalPin }
};
return await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false);
}
private async Task<bool> UnlockParentalStoreAccount(string parentalPin) {
if (string.IsNullOrEmpty(parentalPin)) {
Bot.ArchiLogger.LogNullError(nameof(parentalPin));
return false;
}
const string request = SteamStoreURL + "/parental/ajaxunlock";
Dictionary<string, string> data = new Dictionary<string, string>(1) {
{ "pin", parentalPin }
};
return await WebBrowser.UrlPostRetry(request, data, SteamStoreURL).ConfigureAwait(false);
}
private enum ESteamApiKeyState : byte {
Error,
Registered,