新增手机号绑定邮箱后邮箱模式重登流程

This commit is contained in:
QLHazyCoder
2026-05-16 03:23:28 +08:00
parent 727d1523dd
commit efad1f94d7
16 changed files with 715 additions and 35 deletions
+22 -1
View File
@@ -50,6 +50,11 @@
return String(value || '').trim().toLowerCase() === 'phone' ? 'phone' : 'email';
}
function shouldForceStep7EmailLogin(state = {}) {
return normalizeStep7IdentifierType(state?.forceLoginIdentifierType) === 'email'
|| Boolean(state?.forceEmailLogin);
}
function canUseConfiguredPhoneSignup(state = {}) {
return normalizeStep7SignupMethod(state?.signupMethod) === 'phone'
&& Boolean(state?.phoneVerificationEnabled)
@@ -75,6 +80,10 @@
}
function resolveStep7LoginIdentifierType(state = {}, fallbackType = '') {
if (shouldForceStep7EmailLogin(state)) {
return 'email';
}
if (shouldPreferStep7PhoneSignupIdentity(state)) {
return 'phone';
}
@@ -234,7 +243,19 @@
throwIfStopped();
attempt += 1;
try {
const currentState = attempt === 1 ? state : await getState();
const rawCurrentState = attempt === 1 ? state : await getState();
const currentState = shouldForceStep7EmailLogin(state)
? {
...rawCurrentState,
forceLoginIdentifierType: 'email',
forceEmailLogin: true,
signupMethod: 'email',
resolvedSignupMethod: 'email',
accountIdentifierType: 'email',
accountIdentifier: email,
email,
}
: rawCurrentState;
const password = currentState.password || currentState.customPassword || '';
const currentIdentifierType = resolveStep7LoginIdentifierType(currentState, resolvedIdentifierType);
const currentPhoneNumber = currentIdentifierType === 'phone'