2
This commit is contained in:
@@ -441,10 +441,40 @@ def api_register_flow(
|
||||
return None
|
||||
log_cb("[OK] OTP 验证成功")
|
||||
|
||||
# 创建账户(带重试)
|
||||
log_status("API注册", "创建账户...")
|
||||
if not reg.create_account(real_name, birthdate):
|
||||
log_cb("[X] 创建账户失败")
|
||||
return None
|
||||
create_success = reg.create_account(real_name, birthdate)
|
||||
|
||||
# 如果创建失败,重新获取验证码再试一次
|
||||
if not create_success:
|
||||
log_cb("[!] 创建账户失败,尝试重新验证...")
|
||||
|
||||
# 重新发送验证邮件
|
||||
log_status("API注册", "重新发送验证邮件...")
|
||||
if not reg.send_verification_email():
|
||||
log_cb("[X] 重新发送验证邮件失败")
|
||||
return None
|
||||
log_cb("[OK] 验证邮件已重新发送")
|
||||
|
||||
# 重新获取验证码
|
||||
time.sleep(2) # 等待新邮件
|
||||
otp_code = get_verification_code_api(email, mail_api_base, mail_api_token)
|
||||
if not otp_code:
|
||||
log_cb("[X] 未能获取新验证码")
|
||||
return None
|
||||
|
||||
log_status("API注册", f"重新验证 OTP: {otp_code}")
|
||||
if not reg.validate_otp(otp_code):
|
||||
log_cb("[X] OTP 重新验证失败")
|
||||
return None
|
||||
log_cb("[OK] OTP 重新验证成功")
|
||||
|
||||
# 再次尝试创建账户
|
||||
log_status("API注册", "重新创建账户...")
|
||||
if not reg.create_account(real_name, birthdate):
|
||||
log_cb("[X] 创建账户仍然失败")
|
||||
return None
|
||||
|
||||
log_cb("[OK] 账户创建成功")
|
||||
|
||||
# 验证 session 是否有效
|
||||
|
||||
Reference in New Issue
Block a user