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

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.');
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 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) {
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);