eg: don't await MFA
This commit is contained in:
parent
a10c61379b
commit
db7cf88c1b
1 changed files with 4 additions and 4 deletions
|
|
@ -87,13 +87,13 @@ try {
|
||||||
page.waitForSelector('#h_captcha_challenge_login_prod iframe').then(() => {
|
page.waitForSelector('#h_captcha_challenge_login_prod iframe').then(() => {
|
||||||
console.log('Got a captcha! You may have to solve it in the browser if the NopeCHA extension fails to do so.');
|
console.log('Got a captcha! You may have to solve it in the browser if the NopeCHA extension fails to do so.');
|
||||||
});
|
});
|
||||||
// TODO alternatively wait for redirectUrl
|
// handle MFA, but don't await it
|
||||||
await page.waitForNavigation({ url: '**/id/login/mfa**'}).then(async () => {
|
page.waitForNavigation({ url: '**/id/login/mfa**'}).then(async () => {
|
||||||
console.log('Enter the security code to continue - This appears to be a new device, browser or location. A security code has been sent to your email address at ...');
|
console.log('Enter the security code to continue - This appears to be a new device, browser or location. A security code has been sent to your email address at ...');
|
||||||
const otp = await prompt({type: 'number', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!'});
|
const otp = await prompt({type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!'}); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them
|
||||||
await page.type('input[name="code-input-0"]', otp.toString());
|
await page.type('input[name="code-input-0"]', otp.toString());
|
||||||
await page.click('button[type="submit"]');
|
await page.click('button[type="submit"]');
|
||||||
});
|
}).catch(_ => { });
|
||||||
} else {
|
} else {
|
||||||
console.log('Waiting for you to login in the browser.');
|
console.log('Waiting for you to login in the browser.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue