Modify the current login user's password, the original password must be verified correctly before it can be updated to the new password.
Precautions
- This interface uses the POST method and requires data to be submitted in application/ format
- The original password and the new password need to be provided.
- The user must be logged in, verified through session or Token.
- The new password must meet security requirements (such as length, complexity, etc.)
- You may need to log in again after the modification is successful
Request address
{域名地址}/api/user/password
Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/user/password
Request syntax
POST {域名地址}/api/user/password
Content-Type: application/json
Request header
This interface also involves common request headers. For more information, please seeCommon Request Headers (Common Request Headers).
Request Parameters
| Field Name | Type | Required | Description |
|---|---|---|---|
| old_password | string | Yes | old password |
| password | string | Yes | New password, must meet the security policy requirements |
Response Headers
This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
| Field Name | Type | Description |
|---|---|---|
| code | integer | Error code |
| message | string | Error Description |
Example Usage
Normal request example
POST /api/user/password HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"old_password": "123456",
"password": "newPassword123!"
}
Normal response example
{
"code": 0,
"msg": "密码修改成功"
}
Error request example - Original password is incorrect
POST /api/user/password HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"old_password": "wrong_password",
"password": "newPassword123!"
}
Error response example - Original password is incorrect
{
"code": -1,
"msg": "原密码错误"
}
Error Code
| Error code | Description |
|---|---|
| 0 | OK |
| -1 | Error, the reason is indicated in msg |
| 1001 | Not logged in |
| 1002 | Unauthorized |
| 200 | API request OK |
| 2001 | Original password is incorrect |
| 2002 | New password does not meet the security requirements |