mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-02-28 21:30:59 +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({
|
community.login({
|
||||||
"accountName": accountName,
|
"accountName": accountName,
|
||||||
"password": password,
|
"password": password,
|
||||||
"authCode": authCode,
|
"authCode": authCode,
|
||||||
"twoFactorCode": twoFactorCode
|
"twoFactorCode": twoFactorCode,
|
||||||
|
"captcha": captcha
|
||||||
}, function(err, sessionID, cookies, steamguard) {
|
}, function(err, sessionID, cookies, steamguard) {
|
||||||
if(err) {
|
if(err) {
|
||||||
if(err.message == 'SteamGuardMobile') {
|
if(err.message == 'SteamGuardMobile') {
|
||||||
@ -39,6 +40,15 @@ function doLogin(accountName, password, authCode, twoFactorCode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(err.message == 'CAPTCHA') {
|
||||||
|
console.log(err.captchaurl);
|
||||||
|
rl.question("CAPTCHA: ", function(captchaInput) {
|
||||||
|
doLogin(accountName, password, authCode, twoFactorCode, captchaInput);
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(err);
|
console.log(err);
|
||||||
process.exit();
|
process.exit();
|
||||||
return;
|
return;
|
||||||
|
@ -14,11 +14,12 @@ rl.question("Username: ", function(accountName) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function doLogin(accountName, password, authCode) {
|
function doLogin(accountName, password, authCode, captcha) {
|
||||||
community.login({
|
community.login({
|
||||||
"accountName": accountName,
|
"accountName": accountName,
|
||||||
"password": password,
|
"password": password,
|
||||||
"authCode": authCode
|
"authCode": authCode,
|
||||||
|
"captcha": captcha
|
||||||
}, function(err, sessionID, cookies, steamguard) {
|
}, function(err, sessionID, cookies, steamguard) {
|
||||||
if(err) {
|
if(err) {
|
||||||
if(err.message == 'SteamGuardMobile') {
|
if(err.message == 'SteamGuardMobile') {
|
||||||
@ -29,13 +30,22 @@ function doLogin(accountName, password, authCode) {
|
|||||||
|
|
||||||
if(err.message == 'SteamGuard') {
|
if(err.message == 'SteamGuard') {
|
||||||
console.log("An email has been sent to your address at " + err.emaildomain);
|
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);
|
doLogin(accountName, password, code);
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(err.message == 'CAPTCHA') {
|
||||||
|
console.log(err.captchaurl);
|
||||||
|
rl.question("CAPTCHA: ", function(captchaInput) {
|
||||||
|
doLogin(accountName, password, authCode, captchaInput);
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(err);
|
console.log(err);
|
||||||
process.exit();
|
process.exit();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user