fix: force epic login page and autofill password when email prefilled
All checks were successful
build-and-push / lint (push) Successful in 4s
build-and-push / sonar (push) Successful in 13s
build-and-push / docker (push) Successful in 1m13s

This commit is contained in:
nocci 2025-12-31 13:13:16 +00:00
parent 5c7a945be0
commit 1a34d8f0e4

View file

@ -124,14 +124,14 @@ const ensureLoggedIn = async (page, context) => {
// Epic login form
if (!cfg.eg_email || !cfg.eg_password) return false;
try {
await page.waitForSelector('input[name="email"]', { timeout: cfg.login_visible_timeout }).catch(() => {});
await page.goto('https://www.epicgames.com/id/login?lang=en-US&noHostRedirect=true&redirectUrl=' + URL_CLAIM, { waitUntil: 'domcontentloaded' });
const emailField = page.locator('input[name="email"], input#email');
const passwordField = page.locator('input[name="password"], input#password');
// Some flows pre-fill email and show only password field
if (await emailField.count()) await emailField.fill(cfg.eg_email);
if (await passwordField.count()) {
await passwordField.waitFor({ timeout: cfg.login_visible_timeout });
await passwordField.fill(cfg.eg_password);
await page.click('button[type="submit"]');
}
// MFA step
try {
await page.waitForURL('**/id/login/mfa**', { timeout: cfg.login_timeout });