skip prompt for password if email is missing

This commit is contained in:
Ralf Vogler 2023-02-09 16:28:27 +01:00
parent 65a389c3d9
commit dff712d998
3 changed files with 3 additions and 3 deletions

View file

@ -72,7 +72,7 @@ try {
if (cfg.eg_email && cfg.eg_password) console.info('Using email and password from environment.'); if (cfg.eg_email && cfg.eg_password) console.info('Using email and password from environment.');
else console.info('Press ESC to skip if you want to login in the browser.'); else console.info('Press ESC to skip if you want to login in the browser.');
const email = cfg.eg_email || await prompt({message: 'Enter email'}); const email = cfg.eg_email || await prompt({message: 'Enter email'});
const password = cfg.eg_password || await prompt({type: 'password', message: 'Enter password'}); const password = email && (cfg.eg_password || await prompt({type: 'password', message: 'Enter password'}));
if (email && password) { if (email && password) {
await page.click('text=Sign in with Epic Games'); await page.click('text=Sign in with Epic Games');
await page.fill('#email', email); await page.fill('#email', email);

2
gog.js
View file

@ -44,7 +44,7 @@ try {
if (cfg.gog_email && cfg.gog_password) console.info('Using email and password from environment.'); if (cfg.gog_email && cfg.gog_password) console.info('Using email and password from environment.');
else console.info('Press ESC to skip if you want to login in the browser (not possible in headless mode).'); else console.info('Press ESC to skip if you want to login in the browser (not possible in headless mode).');
const email = cfg.gog_email || await prompt({message: 'Enter email'}); const email = cfg.gog_email || await prompt({message: 'Enter email'});
const password = cfg.gog_password || await prompt({type: 'password', message: 'Enter password'}); const password = email && (cfg.gog_password || await prompt({type: 'password', message: 'Enter password'}));
if (email && password) { if (email && password) {
iframe.locator('a[href="/logout"]').click().catch(_ => { }); // Click 'Change account' (email from previous login is set in some cookie) iframe.locator('a[href="/logout"]').click().catch(_ => { }); // Click 'Change account' (email from previous login is set in some cookie)
await iframe.locator('#login_username').fill(email); await iframe.locator('#login_username').fill(email);

View file

@ -50,7 +50,7 @@ try {
if (cfg.pg_email && cfg.pg_password) console.info('Using email and password from environment.'); if (cfg.pg_email && cfg.pg_password) console.info('Using email and password from environment.');
else console.info('Press ESC to skip if you want to login in the browser (not possible in default headless mode).'); else console.info('Press ESC to skip if you want to login in the browser (not possible in default headless mode).');
const email = cfg.pg_email || await prompt({message: 'Enter email'}); const email = cfg.pg_email || await prompt({message: 'Enter email'});
const password = cfg.pg_password || await prompt({type: 'password', message: 'Enter password'}); const password = email && (cfg.pg_password || await prompt({type: 'password', message: 'Enter password'}));
if (email && password) { if (email && password) {
await page.fill('[name=email]', email); await page.fill('[name=email]', email);
await page.fill('[name=password]', password); await page.fill('[name=password]', password);