mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-09-04 23:19:20 +08:00
fix: 对齐 master 基线下的 Freemail 顺序与 OTP 集成测试
This commit is contained in:
@@ -254,14 +254,6 @@ class FreemailService(BaseEmailService):
|
|||||||
if "openai" not in content.lower():
|
if "openai" not in content.lower():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
v_code = str(mail.get("verification_code") or "").strip()
|
|
||||||
if re.fullmatch(r"\d{6}", v_code):
|
|
||||||
if not self._accept_verification_code(email, v_code, message_marker):
|
|
||||||
continue
|
|
||||||
logger.info(f"从 Freemail 邮箱 {email} 找到验证码: {v_code}")
|
|
||||||
self.update_status(True)
|
|
||||||
return v_code
|
|
||||||
|
|
||||||
code = self._extract_otp_from_text(content, pattern)
|
code = self._extract_otp_from_text(content, pattern)
|
||||||
if code:
|
if code:
|
||||||
if not self._accept_verification_code(email, code, message_marker):
|
if not self._accept_verification_code(email, code, message_marker):
|
||||||
@@ -284,6 +276,14 @@ class FreemailService(BaseEmailService):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"获取 Freemail 邮件详情失败: {e}")
|
logger.debug(f"获取 Freemail 邮件详情失败: {e}")
|
||||||
|
|
||||||
|
v_code = str(mail.get("verification_code") or "").strip()
|
||||||
|
if re.fullmatch(r"\d{6}", v_code):
|
||||||
|
if not self._accept_verification_code(email, v_code, message_marker):
|
||||||
|
continue
|
||||||
|
logger.info(f"从 Freemail 邮箱 {email} 找到验证码: {v_code}")
|
||||||
|
self.update_status(True)
|
||||||
|
return v_code
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"检查 Freemail 邮件时出错: {e}")
|
logger.debug(f"检查 Freemail 邮件时出错: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,9 @@ def test_registration_engine_resend_flow_propagates_new_otp_timestamp_and_valida
|
|||||||
engine.email_service = FakeEmailService()
|
engine.email_service = FakeEmailService()
|
||||||
engine.session = FakeSession()
|
engine.session = FakeSession()
|
||||||
engine._otp_sent_at = None
|
engine._otp_sent_at = None
|
||||||
|
engine.phase_history = []
|
||||||
|
|
||||||
issued_timestamps = iter([1000.0, 1005.0])
|
issued_timestamps = iter([1000.0, 1000.0, 1000.0, 1005.0, 1005.0, 1005.0])
|
||||||
monkeypatch.setattr("src.core.register.time.time", lambda: next(issued_timestamps))
|
monkeypatch.setattr("src.core.register.time.time", lambda: next(issued_timestamps))
|
||||||
|
|
||||||
assert engine._send_verification_code() is True
|
assert engine._send_verification_code() is True
|
||||||
|
|||||||
Reference in New Issue
Block a user