mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 19:55:56 +08:00
新增:更改邮箱相关接口文档
This commit is contained in:
@@ -2304,4 +2304,189 @@ await octokit.request('GET /api/users/:login/applied_projects/:id/refuse.json')
|
||||
"created_at": "2021-06-09 16:41",
|
||||
"time_ago": "7分钟前"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 用户发送邮件验证码
|
||||
用户发送邮件验证码
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/v1/yystopf/send_email_vefify_code.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/v1/:login/send_email_vefify_code.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/v1/:login/send_email_vefify_code.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|login |string |用户标识 |
|
||||
|code_type |int |10: 更新邮箱|
|
||||
|email |string |邮箱|
|
||||
|smscode |string |邮箱md5加密值|
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 用户验证邮件验证码
|
||||
用户验证邮件验证码
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/v1/yystopf/check_email_verify_code.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/v1/:login/check_email_verify_code.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/v1/:login/check_email_verify_code.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|login |string |用户标识 |
|
||||
|code_type |int |10: 更新邮箱|
|
||||
|email |string |邮箱|
|
||||
|code |string |邮箱验证码|
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 用户验证密码
|
||||
用户验证密码,检查是否和用户密码一致
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/v1/yystopf/check_password.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/v1/:login/check_password.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/v1/:login/check_password.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|login |string |用户标识 |
|
||||
|password |string |用户密码|
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 用户验证邮箱
|
||||
用户验证邮箱是否符合规范以及是否已被使用
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/v1/yystopf/check_email.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/v1/:login/check_email.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/v1/:login/check_email.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|login |string |用户标识 |
|
||||
|email |string |邮箱地址|
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 用户更改邮箱
|
||||
用户更改一个新的邮箱
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X PATCH http://localhost:3000/api/v1/yystopf/update_email.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('PATCH /api/v1/:login/update_email.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`PATCH /api/v1/:login/update_email.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|login |string |用户标识 |
|
||||
|password |string |用户密码|
|
||||
|email |string |邮箱地址|
|
||||
|code |string |邮箱验证码|
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"password": "Aa19960425.",
|
||||
"code": "657134",
|
||||
"email": "yystopf@163.com"
|
||||
}
|
||||
```
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
@@ -1,10 +1,10 @@
|
||||
class Api::V1::Users::UpdateEmailService < ApplicationService
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_reader :user, :token, :password, :mail, :old_mail, :code, :code_type, :verify_code
|
||||
attr_reader :user, :token, :password, :mail, :old_mail, :code, :verify_code
|
||||
attr_accessor :gitea_data
|
||||
|
||||
validates :password, :code, :code_type, presence: true
|
||||
validates :password, :code, presence: true
|
||||
validates :mail, presence: true, format: { with: CustomRegexp::EMAIL }
|
||||
|
||||
def initialize(user, params, token =nil)
|
||||
@@ -14,8 +14,7 @@ class Api::V1::Users::UpdateEmailService < ApplicationService
|
||||
@mail = params[:email]
|
||||
@old_mail = user.mail
|
||||
@code = params[:code]
|
||||
@code_type = params[:code_type]
|
||||
@verify_code = VerificationCode.where(email: @mail, code: @code, code_type: @code_type).last
|
||||
@verify_code = VerificationCode.where(email: @mail, code: @code, code_type: 10).last
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
Reference in New Issue
Block a user