From 639fbb0f46aaf90514e7e24d2e3fdb6d00c8d7d5 Mon Sep 17 00:00:00 2001 From: Senkoi <69852562+Senkoi@users.noreply.github.com> Date: Mon, 16 Mar 2026 15:22:58 +0000 Subject: [PATCH] fix(services): exclude email addresses when extracting verification codes --- src/services/custom_domain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/custom_domain.py b/src/services/custom_domain.py index ab2476a..816447f 100644 --- a/src/services/custom_domain.py +++ b/src/services/custom_domain.py @@ -326,8 +326,9 @@ class CustomDomainEmailService(BaseEmailService): if "openai" not in sender and "openai" not in content.lower(): continue - # 提取验证码 - match = re.search(pattern, content) + # 提取验证码 过滤掉邮箱 + email_pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}" + match = re.search(pattern, re.sub(email_pattern, "", content)) if match: code = match.group(1) logger.info(f"从自定义域名邮箱 {email} 找到验证码: {code}")