MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / waitForStep6PasswordSubmitTransition

Function waitForStep6PasswordSubmitTransition

content/signup-page.js:1452–1524  ·  view source on GitHub ↗
(passwordSubmittedAt, timeout = 10000)

Source from the content-addressed store, hash-verified

1450}
1451
1452async function waitForStep6PasswordSubmitTransition(passwordSubmittedAt, timeout = 10000) {
1453 const start = Date.now();
1454 let snapshot = normalizeStep6Snapshot(inspectLoginAuthState());
1455
1456 while (Date.now() - start < timeout) {
1457 throwIfStopped();
1458 snapshot = normalizeStep6Snapshot(inspectLoginAuthState());
1459
1460 if (snapshot.state === 'verification_page') {
1461 return {
1462 action: 'done',
1463 result: createStep6SuccessResult(snapshot, {
1464 via: 'password_submit',
1465 loginVerificationRequestedAt: passwordSubmittedAt,
1466 }),
1467 };
1468 }
1469
1470 if (snapshot.state === 'login_timeout_error_page') {
1471 return {
1472 action: 'recoverable',
1473 result: createStep6RecoverableResult('login_timeout_error_page', snapshot, {
1474 message: '提交密码后进入登录超时报错页。',
1475 }),
1476 };
1477 }
1478
1479 if (snapshot.state === 'oauth_consent_page') {
1480 throw new Error(`提交密码后页面直接进入 OAuth 授权页,未经过登录验证码页。URL: ${snapshot.url}`);
1481 }
1482
1483 if (snapshot.state === 'add_phone_page') {
1484 throw new Error(`提交密码后页面直接进入手机号页面,未经过登录验证码页。URL: ${snapshot.url}`);
1485 }
1486
1487 await sleep(250);
1488 }
1489
1490 snapshot = normalizeStep6Snapshot(inspectLoginAuthState());
1491 if (snapshot.state === 'verification_page') {
1492 return {
1493 action: 'done',
1494 result: createStep6SuccessResult(snapshot, {
1495 via: 'password_submit',
1496 loginVerificationRequestedAt: passwordSubmittedAt,
1497 }),
1498 };
1499 }
1500 if (snapshot.state === 'login_timeout_error_page') {
1501 return {
1502 action: 'recoverable',
1503 result: createStep6RecoverableResult('login_timeout_error_page', snapshot, {
1504 message: '提交密码后进入登录超时报错页。',
1505 }),
1506 };
1507 }
1508 if (snapshot.state === 'oauth_consent_page') {
1509 throw new Error(`提交密码后页面直接进入 OAuth 授权页,未经过登录验证码页。URL: ${snapshot.url}`);

Callers 1

Calls 6

normalizeStep6SnapshotFunction · 0.85
inspectLoginAuthStateFunction · 0.85
createStep6SuccessResultFunction · 0.85
sleepFunction · 0.85
throwIfStoppedFunction · 0.70

Tested by

no test coverage detected