fix(mail): resend 2925 code after quick initial poll

This commit is contained in:
InkCrow
2026-05-13 02:19:00 +08:00
parent 6bd743cbd3
commit 24a0b8a45d
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -551,7 +551,7 @@
}, },
targetEmail: fixedTargetEmail, targetEmail: fixedTargetEmail,
maxResendRequests: mail.provider === '2925' ? 1 : undefined, maxResendRequests: mail.provider === '2925' ? 1 : undefined,
initialPollMaxAttempts: mail.provider === '2925' ? 5 : undefined, initialPollMaxAttempts: mail.provider === '2925' ? 2 : undefined,
resendIntervalMs: mail.provider === LUCKMAIL_PROVIDER resendIntervalMs: mail.provider === LUCKMAIL_PROVIDER
? 15000 ? 15000
: ((mail.provider === HOTMAIL_PROVIDER || mail.provider === '2925') : ((mail.provider === HOTMAIL_PROVIDER || mail.provider === '2925')
+2 -2
View File
@@ -1056,7 +1056,7 @@ test('step 8 completes when polling fails but recovery probe shows oauth consent
]); ]);
}); });
test('step 8 uses a fixed 10-minute lookback window and delays 2925 resend until after one full poll', async () => { test('step 8 uses a fixed 10-minute lookback window and delays 2925 resend until after two quick polls', async () => {
let capturedOptions = null; let capturedOptions = null;
let ensureCalls = 0; let ensureCalls = 0;
let ensureOptions = null; let ensureOptions = null;
@@ -1149,7 +1149,7 @@ test('step 8 uses a fixed 10-minute lookback window and delays 2925 resend until
assert.equal(capturedOptions.filterAfterTimestamp, 300000); assert.equal(capturedOptions.filterAfterTimestamp, 300000);
assert.equal(capturedOptions.resendIntervalMs, 0); assert.equal(capturedOptions.resendIntervalMs, 0);
assert.equal(capturedOptions.maxResendRequests, 1); assert.equal(capturedOptions.maxResendRequests, 1);
assert.equal(capturedOptions.initialPollMaxAttempts, 5); assert.equal(capturedOptions.initialPollMaxAttempts, 2);
assert.equal(capturedOptions.targetEmail, ''); assert.equal(capturedOptions.targetEmail, '');
assert.equal(capturedOptions.beforeSubmit, undefined); assert.equal(capturedOptions.beforeSubmit, undefined);
assert.equal(typeof capturedOptions.getRemainingTimeMs, 'function'); assert.equal(typeof capturedOptions.getRemainingTimeMs, 'function');
+5 -5
View File
@@ -835,7 +835,7 @@ test('verification flow keeps 2925 mailbox polling at 15 refresh attempts even w
assert.ok(pollCall.options.timeoutMs >= 250000); assert.ok(pollCall.options.timeoutMs >= 250000);
}); });
test('verification flow delays 2925 login resend until after the first full mailbox poll fails', async () => { test('verification flow delays 2925 login resend until after the first quick mailbox poll fails', async () => {
const events = []; const events = [];
const pollMaxAttempts = []; const pollMaxAttempts = [];
let pollCalls = 0; let pollCalls = 0;
@@ -894,7 +894,7 @@ test('verification flow delays 2925 login resend until after the first full mail
{ provider: '2925', label: '2925 邮箱' }, { provider: '2925', label: '2925 邮箱' },
{ {
maxResendRequests: 1, maxResendRequests: 1,
initialPollMaxAttempts: 5, initialPollMaxAttempts: 2,
requestFreshCodeFirst: false, requestFreshCodeFirst: false,
filterAfterTimestamp: 123, filterAfterTimestamp: 123,
resendIntervalMs: 0, resendIntervalMs: 0,
@@ -902,7 +902,7 @@ test('verification flow delays 2925 login resend until after the first full mail
); );
assert.deepStrictEqual(events.slice(0, 3), ['poll', 'resend', 'poll']); assert.deepStrictEqual(events.slice(0, 3), ['poll', 'resend', 'poll']);
assert.deepStrictEqual(pollMaxAttempts.slice(0, 2), [5, 15]); assert.deepStrictEqual(pollMaxAttempts.slice(0, 2), [2, 15]);
assert.equal(events.filter((event) => event === 'resend').length, 1); assert.equal(events.filter((event) => event === 'resend').length, 1);
}); });
@@ -969,14 +969,14 @@ test('verification flow uses full 2925 polling window after a rejected login cod
{ provider: '2925', label: '2925 邮箱' }, { provider: '2925', label: '2925 邮箱' },
{ {
maxResendRequests: 0, maxResendRequests: 0,
initialPollMaxAttempts: 5, initialPollMaxAttempts: 2,
requestFreshCodeFirst: false, requestFreshCodeFirst: false,
filterAfterTimestamp: 123, filterAfterTimestamp: 123,
resendIntervalMs: 0, resendIntervalMs: 0,
} }
); );
assert.deepStrictEqual(pollMaxAttempts, [5, 15]); assert.deepStrictEqual(pollMaxAttempts, [2, 15]);
assert.deepStrictEqual(submittedCodes, ['111111', '222222']); assert.deepStrictEqual(submittedCodes, ['111111', '222222']);
}); });