diff --git a/Test-Registration-With-Verification.ps1 b/Test-Registration-With-Verification.ps1 deleted file mode 100644 index 290d6fd..0000000 --- a/Test-Registration-With-Verification.ps1 +++ /dev/null @@ -1,59 +0,0 @@ -# 测试带验证码的注册流程 -# 作者: moyin -# 日期: 2025-12-17 - -$baseUrl = "http://localhost:3000" -$testEmail = "test@example.com" - -Write-Host "=== 测试带验证码的注册流程 ===" -ForegroundColor Green - -# 步骤1: 发送邮箱验证码 -Write-Host "`n1. 发送邮箱验证码..." -ForegroundColor Yellow -$sendVerificationBody = @{ - email = $testEmail -} | ConvertTo-Json - -try { - $sendResponse = Invoke-RestMethod -Uri "$baseUrl/auth/send-email-verification" -Method POST -Body $sendVerificationBody -ContentType "application/json" - Write-Host "发送验证码响应: $($sendResponse | ConvertTo-Json -Depth 3)" -ForegroundColor Cyan - - if ($sendResponse.success) { - Write-Host "✓ 验证码发送成功" -ForegroundColor Green - - # 步骤2: 提示用户输入验证码 - Write-Host "`n2. 请输入收到的验证码..." -ForegroundColor Yellow - $verificationCode = Read-Host "验证码" - - # 步骤3: 使用验证码注册 - Write-Host "`n3. 使用验证码注册..." -ForegroundColor Yellow - $registerBody = @{ - username = "testuser_$(Get-Date -Format 'yyyyMMddHHmmss')" - password = "password123" - nickname = "测试用户" - email = $testEmail - email_verification_code = $verificationCode - } | ConvertTo-Json - - $registerResponse = Invoke-RestMethod -Uri "$baseUrl/auth/register" -Method POST -Body $registerBody -ContentType "application/json" - Write-Host "注册响应: $($registerResponse | ConvertTo-Json -Depth 3)" -ForegroundColor Cyan - - if ($registerResponse.success) { - Write-Host "✓ 注册成功!" -ForegroundColor Green - Write-Host "用户信息: $($registerResponse.data.user | ConvertTo-Json -Depth 2)" -ForegroundColor Cyan - } else { - Write-Host "✗ 注册失败: $($registerResponse.message)" -ForegroundColor Red - } - } else { - Write-Host "✗ 验证码发送失败: $($sendResponse.message)" -ForegroundColor Red - } -} catch { - Write-Host "✗ 请求失败: $($_.Exception.Message)" -ForegroundColor Red - if ($_.Exception.Response) { - $errorResponse = $_.Exception.Response.GetResponseStream() - $reader = New-Object System.IO.StreamReader($errorResponse) - $errorBody = $reader.ReadToEnd() - Write-Host "错误详情: $errorBody" -ForegroundColor Red - } -} - -Write-Host "`n=== 测试完成 ===" -ForegroundColor Green \ No newline at end of file