限制手机号注册流程使用号码复用

This commit is contained in:
QLHazyCoder
2026-05-15 18:23:41 +08:00
parent 81fc40706a
commit 4c2ab31b07
9 changed files with 929 additions and 26 deletions
+42
View File
@@ -188,6 +188,42 @@
verifyHotmailAccount,
} = deps;
function preserveKeyFromState(updates, currentState, key) {
if (!Object.prototype.hasOwnProperty.call(updates, key)) {
return;
}
if (currentState?.[key] !== undefined) {
updates[key] = currentState[key];
} else {
delete updates[key];
}
}
function preservePhoneReuseSettingsForPhoneSignup(updates, currentState = {}) {
if (!updates || typeof updates !== 'object') {
return;
}
if (
Object.prototype.hasOwnProperty.call(updates, 'phoneSmsReuseEnabled')
|| Object.prototype.hasOwnProperty.call(updates, 'heroSmsReuseEnabled')
) {
const currentReuseEnabled = currentState?.phoneSmsReuseEnabled ?? currentState?.heroSmsReuseEnabled;
if (currentReuseEnabled !== undefined) {
const normalizedReuseEnabled = Boolean(currentReuseEnabled);
updates.phoneSmsReuseEnabled = normalizedReuseEnabled;
updates.heroSmsReuseEnabled = normalizedReuseEnabled;
} else {
delete updates.phoneSmsReuseEnabled;
delete updates.heroSmsReuseEnabled;
}
}
preserveKeyFromState(updates, currentState, 'freePhoneReuseEnabled');
preserveKeyFromState(updates, currentState, 'freePhoneReuseAutoEnabled');
preserveKeyFromState(updates, currentState, 'phonePreferredActivation');
}
async function appendManualAccountRunRecordIfNeeded(status, stateOverride = null, reason = '') {
if (typeof appendAccountRunRecord !== 'function') {
return null;
@@ -1248,6 +1284,12 @@
) {
updates.signupMethod = resolveSignupMethod(nextSignupState);
}
const nextPersistedSignupMethod = Object.prototype.hasOwnProperty.call(updates, 'signupMethod')
? updates.signupMethod
: currentState?.signupMethod;
if (normalizeSignupMethod(nextPersistedSignupMethod) === 'phone') {
preservePhoneReuseSettingsForPhoneSignup(updates, currentState);
}
const modeChanged = Object.prototype.hasOwnProperty.call(updates, 'plusModeEnabled')
&& Boolean(currentState?.plusModeEnabled) !== Boolean(updates.plusModeEnabled);
const plusPaymentChanged = Object.prototype.hasOwnProperty.call(updates, 'plusPaymentMethod')