mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-28 13:20:23 +08:00
Prompt for CAPTCHA input in examples if needed (fixes #88)
This commit is contained in:
parent
58927dc937
commit
579fc04c1c
@ -14,12 +14,13 @@ rl.question("Username: ", function(accountName) {
|
||||
});
|
||||
});
|
||||
|
||||
function doLogin(accountName, password, authCode, twoFactorCode) {
|
||||
function doLogin(accountName, password, authCode, twoFactorCode, captcha) {
|
||||
community.login({
|
||||
"accountName": accountName,
|
||||
"password": password,
|
||||
"authCode": authCode,
|
||||
"twoFactorCode": twoFactorCode
|
||||
"twoFactorCode": twoFactorCode,
|
||||
"captcha": captcha
|
||||
}, function(err, sessionID, cookies, steamguard) {
|
||||
if(err) {
|
||||
if(err.message == 'SteamGuardMobile') {
|
||||
@ -39,6 +40,15 @@ function doLogin(accountName, password, authCode, twoFactorCode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(err.message == 'CAPTCHA') {
|
||||
console.log(err.captchaurl);
|
||||
rl.question("CAPTCHA: ", function(captchaInput) {
|
||||
doLogin(accountName, password, authCode, twoFactorCode, captchaInput);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(err);
|
||||
process.exit();
|
||||
return;
|
||||
|
@ -14,11 +14,12 @@ rl.question("Username: ", function(accountName) {
|
||||
});
|
||||
});
|
||||
|
||||
function doLogin(accountName, password, authCode) {
|
||||
function doLogin(accountName, password, authCode, captcha) {
|
||||
community.login({
|
||||
"accountName": accountName,
|
||||
"password": password,
|
||||
"authCode": authCode
|
||||
"authCode": authCode,
|
||||
"captcha": captcha
|
||||
}, function(err, sessionID, cookies, steamguard) {
|
||||
if(err) {
|
||||
if(err.message == 'SteamGuardMobile') {
|
||||
@ -29,13 +30,22 @@ function doLogin(accountName, password, authCode) {
|
||||
|
||||
if(err.message == 'SteamGuard') {
|
||||
console.log("An email has been sent to your address at " + err.emaildomain);
|
||||
rl.question("Steam Guard Code: ", function(code) {
|
||||
rl.question("Steam Guard Code: ", function (code) {
|
||||
doLogin(accountName, password, code);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(err.message == 'CAPTCHA') {
|
||||
console.log(err.captchaurl);
|
||||
rl.question("CAPTCHA: ", function(captchaInput) {
|
||||
doLogin(accountName, password, authCode, captchaInput);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(err);
|
||||
process.exit();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user