pg: TODO check for wrong credentials
This commit is contained in:
parent
0e7e7b08f3
commit
3b1b900d77
1 changed files with 4 additions and 1 deletions
|
|
@ -58,6 +58,9 @@ try {
|
||||||
await page.fill('[name=password]', password);
|
await page.fill('[name=password]', password);
|
||||||
await page.check('[name=rememberMe]');
|
await page.check('[name=rememberMe]');
|
||||||
await page.click('input[type="submit"]');
|
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
|
// handle MFA, but don't await it
|
||||||
page.waitForNavigation({ url: '**/ap/mfa**'}).then(async () => {
|
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');
|
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
|
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.type('input[name=otpCode]', otp.toString());
|
||||||
await page.click('input[type="submit"]');
|
await page.click('input[type="submit"]');
|
||||||
});
|
}).catch(_ => { });
|
||||||
} else {
|
} else {
|
||||||
if (cfg.headless) {
|
if (cfg.headless) {
|
||||||
console.log('Please run `node prime-gaming show` to login in the opened browser.');
|
console.log('Please run `node prime-gaming show` to login in the opened browser.');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue