feat: Enhance login flow with add-email and phone verification support

- Added support for the add-email page in the logging status module.
- Updated step 8 to handle phone-registered accounts during email verification.
- Implemented logic to submit add-email before polling for email verification codes.
- Enhanced tests for step 7 to detect username input as phone number and ignore hidden inputs.
- Improved step 8 to allow add-email handoff only when requested.
- Updated documentation to reflect changes in the login verification flow.
This commit is contained in:
QLHazyCoder
2026-05-05 01:47:58 +08:00
parent 6b3917d4b7
commit d054ff65de
11 changed files with 1323 additions and 176 deletions
+15 -2
View File
@@ -7198,6 +7198,7 @@ function getLoginAuthStateLabel(state) {
case 'login_timeout_error_page': return '登录超时报错页';
case 'oauth_consent_page': return 'OAuth 授权页';
case 'add_phone_page': return '手机号页';
case 'add_email_page': return '添加邮箱页';
default: return '未知页面';
}
}
@@ -10345,10 +10346,12 @@ const step8Executor = self.MultiPageBackgroundStep8?.createStep8Executor({
isVerificationMailPollingError,
LUCKMAIL_PROVIDER,
resolveVerificationStep: verificationFlowHelpers.resolveVerificationStep,
resolveSignupEmailForFlow,
phoneVerificationHelpers,
rerunStep7ForStep8Recovery: (...args) => rerunStep7ForStep8Recovery(...args),
resolveSignupMethod,
reuseOrCreateTab,
sendToContentScriptResilient,
setState,
shouldUseCustomRegistrationEmail,
sleepWithStop,
@@ -11305,7 +11308,12 @@ async function ensureStep8VerificationPageReady(options = {}) {
...overrides,
});
let pageState = await inspectState();
if (pageState.state === 'verification_page' || pageState.state === 'oauth_consent_page') {
if (
pageState.state === 'verification_page'
|| pageState.state === 'oauth_consent_page'
|| (options.allowPhoneVerificationPage && pageState.state === 'phone_verification_page')
|| (options.allowAddEmailPage && pageState.state === 'add_email_page')
) {
return pageState;
}
@@ -11379,7 +11387,12 @@ async function ensureStep8VerificationPageReady(options = {}) {
logMessage: '认证页恢复后,正在确认验证码页是否可继续...',
logStepKey: 'fetch-login-code',
});
if (pageState.state === 'verification_page' || pageState.state === 'oauth_consent_page') {
if (
pageState.state === 'verification_page'
|| pageState.state === 'oauth_consent_page'
|| (options.allowPhoneVerificationPage && pageState.state === 'phone_verification_page')
|| (options.allowAddEmailPage && pageState.state === 'add_email_page')
) {
return pageState;
}
if (pageState.maxCheckAttemptsBlocked) {