修复手机号注册登录密码页与成功清理

This commit is contained in:
QLHazyCoder
2026-05-28 06:52:35 +08:00
parent 2992cc88ac
commit fae7b9bffd
9 changed files with 797 additions and 12 deletions
+42 -1
View File
@@ -2645,6 +2645,19 @@ async function step2_clickRegister(payload = {}) {
// ============================================================
async function step3_fillEmailPassword(payload) {
const resolvePasswordPageInfo = (rawUrl = '') => {
const url = String(rawUrl || '').trim() || String(location.href || '');
let path = String(location.pathname || '').trim();
try {
path = new URL(url, 'https://auth.openai.com').pathname || path;
} catch {
// Keep the current pathname fallback; this only tags the completion payload.
}
const mode = /\/log-in\/password(?:[/?#]|$)/i.test(path)
? 'login'
: (/\/(?:create-account|u\/signup|signup)\/password(?:[/?#]|$)/i.test(path) ? 'signup' : '');
return { url, path, mode };
};
const performOperationWithDelay = typeof getOperationDelayRunner === 'function'
? getOperationDelayRunner()
: async (metadata, operation) => {
@@ -2714,6 +2727,7 @@ async function step3_fillEmailPassword(payload) {
throw new Error(`当前密码页邮箱为 ${snapshot.displayedEmail},与目标邮箱 ${email} 不一致,请先回到步骤 1 重新开始。`);
}
const passwordPageInfo = resolvePasswordPageInfo(snapshot.url || location.href);
await humanPause(600, 1500);
await performOperationWithDelay({ stepKey: 'fill-password', kind: 'fill', label: 'signup-password' }, async () => {
fillInput(snapshot.passwordInput, password);
@@ -2730,7 +2744,8 @@ async function step3_fillEmailPassword(payload) {
logSignupPasswordDiagnostics('步骤 3:当前密码页同时存在一次性验证码入口', 'info');
}
const signupVerificationRequestedAt = submitBtn ? Date.now() : null;
const isLoginPasswordPage = passwordPageInfo.mode === 'login';
const signupVerificationRequestedAt = submitBtn && !isLoginPasswordPage ? Date.now() : null;
const completionPayload = {
email,
phoneNumber: String(payload?.phoneNumber || '').trim(),
@@ -2738,6 +2753,10 @@ async function step3_fillEmailPassword(payload) {
accountIdentifier,
signupVerificationRequestedAt,
deferredSubmit: Boolean(submitBtn),
passwordPageUrl: passwordPageInfo.url,
passwordPagePath: passwordPageInfo.path,
passwordPageMode: passwordPageInfo.mode,
...(isLoginPasswordPage ? { passwordLoginFlow: true } : {}),
};
reportComplete(3, completionPayload);
@@ -4893,6 +4912,13 @@ function inspectSignupVerificationState() {
};
}
if (typeof isOAuthConsentPage === 'function' && isOAuthConsentPage()) {
return {
state: 'oauth_consent_page',
url: location.href,
};
}
if (isSignupPasswordErrorPage()) {
const timeoutPage = getSignupPasswordTimeoutErrorPageState();
return {
@@ -4954,6 +4980,7 @@ async function waitForSignupVerificationTransition(timeout = 5000) {
if (
snapshot.state === 'step5'
|| snapshot.state === 'logged_in_home'
|| snapshot.state === 'oauth_consent_page'
|| snapshot.state === 'verification'
|| snapshot.state === 'contact_verification_server_error'
|| snapshot.state === 'error'
@@ -5051,6 +5078,20 @@ async function prepareSignupVerificationFlow(payload = {}, timeout = 30000) {
};
}
if (snapshot.state === 'oauth_consent_page') {
log(`${prepareLogLabel}:页面已直接进入 OAuth 授权页,本步骤按已完成处理。`, 'ok');
return {
ready: true,
alreadyVerified: true,
state: 'oauth_consent_page',
skipLoginVerificationStep: true,
directOAuthConsentPage: true,
skipProfileStep: true,
retried: recoveryRound,
prepareSource,
};
}
if (snapshot.state === 'verification') {
await waitForDocumentLoadComplete(15000, `${prepareLogLabel}:注册验证码页面`);
await waitForVerificationCodeTarget(15000);