forked from datawhale/whale-town-end
feat: 邮箱冲突检测优化 v1.1.1
- 新增邮箱冲突检测:发送验证码前检查邮箱是否已被注册 - 优化用户体验:避免向已注册邮箱发送无用验证码 - 改进错误处理:返回409 Conflict状态码和明确错误信息 - 更新API文档:重新整理文档结构,突出前端开发要点 - 完善测试用例:添加邮箱冲突检测相关测试 - 版本升级:1.1.0 1.1.1 核心修改: - src/core/login_core/login_core.service.ts: 在sendEmailVerification方法中添加邮箱存在性检查 - src/business/auth/controllers/login.controller.ts: 正确处理409冲突状态码 - docs/api/api-documentation.md: 重新整理为精简实用的前端开发文档 - docs/api/openapi.yaml: 更新版本和接口描述 - test-register-fix.ps1: 添加邮箱冲突检测测试用例
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: Pixel Game Server - Auth API
|
||||
description: 像素游戏服务器用户认证API接口文档 - 包含验证码登录功能
|
||||
version: 1.1.0
|
||||
description: 像素游戏服务器用户认证API接口文档 - 包含验证码登录功能和邮箱冲突检测
|
||||
version: 1.1.1
|
||||
contact:
|
||||
name: API Support
|
||||
email: support@example.com
|
||||
@@ -106,7 +106,7 @@ paths:
|
||||
tags:
|
||||
- auth
|
||||
summary: 用户注册
|
||||
description: 创建新用户账户
|
||||
description: 创建新用户账户。如果提供邮箱,需要先调用发送验证码接口获取验证码。发送验证码接口会自动检查邮箱是否已被注册,避免向已存在邮箱发送验证码。
|
||||
operationId: register
|
||||
requestBody:
|
||||
required: true
|
||||
@@ -325,7 +325,7 @@ paths:
|
||||
tags:
|
||||
- auth
|
||||
summary: 发送邮箱验证码
|
||||
description: 向指定邮箱发送验证码
|
||||
description: 向指定邮箱发送验证码。如果邮箱已被注册,将返回冲突错误。
|
||||
operationId: sendEmailVerification
|
||||
requestBody:
|
||||
required: true
|
||||
@@ -354,6 +354,16 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
'409':
|
||||
description: 邮箱已被注册
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorResponse'
|
||||
example:
|
||||
success: false
|
||||
message: "邮箱已被注册,请使用其他邮箱或直接登录"
|
||||
error_code: "SEND_EMAIL_VERIFICATION_FAILED"
|
||||
'429':
|
||||
description: 发送频率过高
|
||||
content:
|
||||
|
||||
Reference in New Issue
Block a user