eg: TODO locator for 2FA text (email or app?)

This commit is contained in:
Ralf Vogler 2023-01-19 00:57:56 +01:00
parent 5babbb6bc1
commit 351670f426

View file

@ -86,6 +86,7 @@ try {
// handle MFA, but don't await it
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 ...');
// TODO locator for text (email or app?)
const otp = cfg.eg_otpkey && authenticator.generate(cfg.eg_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="code-input-0"]', otp.toString());
await page.click('button[type="submit"]');