Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

特性:邮箱验证 #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/06.anniv/00.readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ interface ResponseBody<T> {

通用错误如下表所示:

| 错误代码 | 详情 |
| -------- | -------------- |
| `900000` | 站点致命错误 |
| `900001` | 数据库连接错误 |
| `901000` | 数据写入错误 |
| `901001` | 数据读取错误 |
| `902000` | 内容不存在 |
| `902001` | 无权访问 |
| `902002` | 用户未登录 |
| `902003` | 非法参数 |
| 错误代码 | 详情 |
| -------- | ------------------------ |
| `900000` | 站点致命错误 |
| `900001` | 数据库连接错误 |
| `901000` | 数据写入错误 |
| `901001` | 数据读取错误 |
| `902000` | 内容不存在 |
| `902001` | 无权访问 |
| `902002` | 用户未登录 |
| `902003` | 非法参数 |
| `903000` | 超出频率限制,请稍后再试 |
58 changes: 38 additions & 20 deletions src/06.anniv/02.user.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

## 错误代码一览

| 错误代码 | 详情 |
| -------- | -------------- |
| `102001` | 注册邮箱不可用 |
| `102010` | 邮箱或密码错误 |
| `102020` | 用户不存在 |
| 错误代码 | 详情 |
| -------- | ---------------- |
| `102001` | 注册邮箱不可用 |
| `102010` | 邮箱或密码错误 |
| `102020` | 用户不存在 |
| `102030` | 验证邮件发送失败 |

## 对用户密码的预处理

Expand All @@ -24,14 +25,17 @@

用户已登录时,返回当前用户信息(`UserInfo`)。

当用户的 `verified` 为 `false` 时,表明用户邮箱未验证。服务端可能会限制用户可用的接口,产生错误 `902001`:无权访问。

#### 返回参数

| 参数名 | 类型 | 详情 |
| ---------- | -------- | -------- |
| `user_id` | `string` | 用户 ID |
| `email` | `string` | 邮箱 |
| `nickname` | `string` | 昵称 |
| `avatar` | `string` | 头像链接 |
| 参数名 | 类型 | 详情 |
| ---------- | --------- | -------------------- |
| `user_id` | `string` | 用户 ID |
| `email` | `string` | 邮箱 |
| `nickname` | `string` | 昵称 |
| `avatar` | `string` | 头像链接 |
| `verified` | `boolean` | 用户邮箱是否已经确认 |

### 参数表示

Expand All @@ -41,6 +45,7 @@ interface UserInfo {
email: string;
nickname: string;
avatar: string;
verified: boolean;
}
```

Expand Down Expand Up @@ -105,7 +110,7 @@ interface UserIntro {

### 返回

注册成功时,返回用户信息(`UserInfo`)。
注册成功时,返回用户信息(`UserInfo`)。此时用户的 `verified` 为 `false`。

### 参数表示

Expand All @@ -122,9 +127,7 @@ interface UserRegisterBody {

| 错误代码 | 详情 |
| -------- | ---------------- |
| `102000` | 注册用户名不可用 |
| `102001` | 注册邮箱不可用 |
| `102002` | 注册密码格式错误 |

## 用户登录

Expand Down Expand Up @@ -212,12 +215,27 @@ interface UserRevokeBody {

#### 请求参数

| 参数 | 类型 | 详情 |
| ------- | -------- | ---- |
| `email` | `string` | 邮箱 |
| 参数 | 类型 | 详情 |
| ---------- | -------- | ------ |
| `email` | `string` | 邮箱 |

### 错误列表

| 错误代码 | 详情 |
| -------- | -------------- |
| `102001` | 注册邮箱不可用 |
| 错误代码 | 详情 |
| -------- | ---------------- |
| `102001` | 注册邮箱不可用 |

## 验证邮箱

向用户的当前邮箱发送验证邮件。

### Endpoint

`POST /api/user/email/verify`

### 错误列表

| 错误代码 | 详情 |
| -------- | ------------------------ |
| `102030` | 验证邮件发送失败 |
| `903000` | 超出频率限制,请稍后再试 |