feat: 实现密码重置功能与用户搜索API,优化注册登录流程
- 新增忘记密码页面与重置密码确认流程(前端+后端) - 修复注册验证码页登录跳转路由 - 新增用户搜索API(按邮箱查询) - 简化infra脚本,统一为app.sh - 补充密码重置与用户API测试覆盖 - 更新runtime文档与AGENTS配置
This commit is contained in:
@@ -171,6 +171,48 @@
|
||||
|
||||
---
|
||||
|
||||
### POST /auth/password-reset
|
||||
|
||||
发送密码重置验证码。
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"email": "string (email)",
|
||||
"redirect_to": "string? (optional)"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:** 204 No Content
|
||||
|
||||
**Errors:**
|
||||
- 422: 请求参数无效
|
||||
- 429: 请求过于频繁
|
||||
|
||||
---
|
||||
|
||||
### POST /auth/password-reset/confirm
|
||||
|
||||
验证 recovery 验证码并完成改密。
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"email": "string (email)",
|
||||
"token": "string (6 digits)",
|
||||
"new_password": "string (min 6 chars)"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:** 204 No Content
|
||||
|
||||
**Errors:**
|
||||
- 401: 验证码无效或已过期
|
||||
- 422: 请求参数无效
|
||||
- 429: 请求过于频繁
|
||||
|
||||
---
|
||||
|
||||
### GET /auth/users
|
||||
|
||||
按邮箱查询用户(需要认证)。
|
||||
@@ -245,26 +287,38 @@
|
||||
|
||||
---
|
||||
|
||||
### GET /users/{username}
|
||||
### POST /users/search
|
||||
|
||||
按用户名查询用户(需要认证)。
|
||||
搜索用户(需要认证)。
|
||||
|
||||
**Path Parameters:**
|
||||
- `username`: string (3-30 chars, alphanumeric and underscore)
|
||||
支持两种查询模式:
|
||||
- **用户名查询**:模糊匹配,返回最多 20 个结果
|
||||
- **邮箱查询**:精确匹配,返回 0 或 1 个结果
|
||||
|
||||
查询类型自动识别:包含 `@` 符号视为邮箱查询。
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"query": "string (1-100 chars)"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:** 200 OK
|
||||
```json
|
||||
{
|
||||
"id": "string",
|
||||
"username": "string",
|
||||
"avatar_url": "string?",
|
||||
"bio": "string?"
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": "string",
|
||||
"username": "string",
|
||||
"avatar_url": "string?",
|
||||
"bio": "string?"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- 401: 未认证
|
||||
- 404: 用户不存在
|
||||
- 503: Auth 服务不可用(仅邮箱查询)
|
||||
- 422: 请求参数无效
|
||||
|
||||
---
|
||||
|
||||
@@ -244,3 +244,4 @@ docker compose --env-file .env -f infra/docker/docker-compose.yml up -d --force-
|
||||
| 2026-02-25 | 简化启动方式:dev-app-up -> app-up,分离 bootstrap 与服务启动 |
|
||||
| 2026-02-25 | 重构为运维分层手册:Bootstrap Gate、分层验证、故障与回滚流程 |
|
||||
| 2026-02-25 | 新增配置漂移故障条目:修复 Auth 邮件模板失效与 signup 超时场景 |
|
||||
| 2026-02-27 | 用户搜索支持邮箱精确匹配:query 含 @ 符号时走 auth.users → profiles 两步查询 |
|
||||
|
||||
Reference in New Issue
Block a user