feat(registration): Add email retry mechanism with team invitation support
- Add automatic email retry logic when verification code times out (5-second timeout) - Implement new email creation and team invitation for failed verification attempts - Add max_email_retries parameter to control retry attempts (default: 3) - Add team_name parameter to enable automatic team invitations for new emails - Return special "new_email:xxx@xxx.com:password" format when new email is used - Update register_openai_account_auto() to support team_name parameter - Update register_and_authorize() to support team_name parameter and return new email info - Improve verification code timeout handling with configurable retry intervals - Add nonlocal verification_timeout flag to track timeout state across retries - Update docstrings to document new parameters and return value changes
This commit is contained in:
42
run.py
42
run.py
@@ -407,7 +407,26 @@ def process_accounts(accounts: list, team_name: str, team_index: int = 0,
|
||||
else:
|
||||
# 新账号: 注册 + Codex 授权
|
||||
progress_update(phase="注册", step="注册 OpenAI...")
|
||||
register_success, codex_data = register_and_authorize(email, password)
|
||||
register_success, codex_data, new_email_info = register_and_authorize(email, password, team_name=team_name)
|
||||
|
||||
# 如果使用了新邮箱,更新 tracker
|
||||
if new_email_info:
|
||||
new_email = new_email_info["email"]
|
||||
new_password = new_email_info["password"]
|
||||
log.info(f"验证码超时,已切换到新邮箱: {new_email}")
|
||||
|
||||
# 从 tracker 中移除旧邮箱
|
||||
remove_account_from_tracker(_tracker, team_name, email)
|
||||
|
||||
# 添加新邮箱到 tracker
|
||||
add_account_with_password(_tracker, team_name, new_email, new_password, "registered")
|
||||
save_team_tracker(_tracker)
|
||||
|
||||
# 更新当前处理的邮箱信息
|
||||
email = new_email
|
||||
password = new_password
|
||||
result["email"] = email
|
||||
result["password"] = password
|
||||
|
||||
# 检查是否是域名黑名单错误
|
||||
if register_success == "domain_blacklisted":
|
||||
@@ -643,7 +662,26 @@ def _process_single_account_worker(
|
||||
register_success = True
|
||||
else:
|
||||
log.info(f"[Worker-{worker_id}] 新账号,注册 + 授权...", icon="auth")
|
||||
register_success, codex_data = register_and_authorize(email, password)
|
||||
register_success, codex_data, new_email_info = register_and_authorize(email, password, team_name=team_name)
|
||||
|
||||
# 如果使用了新邮箱,更新 tracker
|
||||
if new_email_info:
|
||||
new_email = new_email_info["email"]
|
||||
new_password = new_email_info["password"]
|
||||
log.info(f"[Worker-{worker_id}] 验证码超时,已切换到新邮箱: {new_email}")
|
||||
|
||||
with _tracker_lock:
|
||||
# 从 tracker 中移除旧邮箱
|
||||
remove_account_from_tracker(_tracker, team_name, email)
|
||||
# 添加新邮箱到 tracker
|
||||
add_account_with_password(_tracker, team_name, new_email, new_password, "registered")
|
||||
save_team_tracker(_tracker)
|
||||
|
||||
# 更新当前处理的邮箱信息
|
||||
email = new_email
|
||||
password = new_password
|
||||
result["email"] = email
|
||||
result["password"] = password
|
||||
|
||||
if register_success == "domain_blacklisted":
|
||||
domain = get_domain_from_email(email)
|
||||
|
||||
Reference in New Issue
Block a user