feat: 添加提取和验证ChatGPT登录代码的功能
This commit is contained in:
@@ -549,6 +549,10 @@ return {
|
||||
|
||||
test('extractVerificationCode strict mode matches the new suspicious log-in mail body', () => {
|
||||
const bundle = [
|
||||
extractFunction('extractStrictChatGPTVerificationCode'),
|
||||
extractFunction('isLikelyCompactTimeValue'),
|
||||
extractFunction('isLikelyHeaderTimestampCode'),
|
||||
extractFunction('findSafeStandaloneSixDigitCode'),
|
||||
extractFunction('extractVerificationCode'),
|
||||
].join('\n');
|
||||
|
||||
@@ -562,6 +566,32 @@ return { extractVerificationCode };
|
||||
assert.equal(api.extractVerificationCode(bodyText, false), '982219');
|
||||
});
|
||||
|
||||
test('extractVerificationCode ignores compact header time before fallback code', () => {
|
||||
const bundle = [
|
||||
extractFunction('extractStrictChatGPTVerificationCode'),
|
||||
extractFunction('isLikelyCompactTimeValue'),
|
||||
extractFunction('isLikelyHeaderTimestampCode'),
|
||||
extractFunction('findSafeStandaloneSixDigitCode'),
|
||||
extractFunction('extractVerificationCode'),
|
||||
].join('\n');
|
||||
|
||||
const api = new Function(`
|
||||
${bundle}
|
||||
return { extractVerificationCode };
|
||||
`)();
|
||||
|
||||
const bodyText = [
|
||||
'Your temporary ChatGPT login code',
|
||||
'From: otp <otp@tm1.openai.com>',
|
||||
'To: test@example.com',
|
||||
'Time: 2026-4-22 101755',
|
||||
'OpenAI',
|
||||
'371138',
|
||||
].join('\n');
|
||||
|
||||
assert.equal(api.extractVerificationCode(bodyText, false), '371138');
|
||||
});
|
||||
|
||||
test('openMailAndGetMessageText always returns to inbox after opening a 2925 message', async () => {
|
||||
const bundle = [
|
||||
extractFunction('returnToInbox'),
|
||||
|
||||
Reference in New Issue
Block a user