diff --git a/prime-gaming.js b/prime-gaming.js index ee07acb..e562452 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -58,6 +58,9 @@ try { await page.fill('[name=password]', password); await page.check('[name=rememberMe]'); await page.click('input[type="submit"]'); + page.waitForNavigation({ url: '**/ap/signin**'}).then(async () => { // TODO check for wrong credentials + console.error(await page.locator('.a-alert-content').first().innerText()); + }).catch(_ => { }); // handle MFA, but don't await it page.waitForNavigation({ url: '**/ap/mfa**'}).then(async () => { console.log('Two-Step Verification - enter the One Time Password (OTP), e.g. generated by your Authenticator App'); @@ -65,7 +68,7 @@ try { const otp = cfg.pg_otpkey && authenticator.generate(cfg.pg_otpkey) || 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=otpCode]', otp.toString()); await page.click('input[type="submit"]'); - }); + }).catch(_ => { }); } else { if (cfg.headless) { console.log('Please run `node prime-gaming show` to login in the opened browser.');