Change the password of the currently logged-in user. It is necessary to verify the correctness of the original password before updating it to a new password.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- Provide the original password and the new password.
- 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:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/user/password
Request Syntax
POST {域名地址}/api/user/password
Content-Type: application/json
Request Headers
This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Request parameters
| Field name | Type | Required | Description |
|---|---|---|---|
| old_password | string | Is | old password |
| password | string | Is | new password, must meet security policy requirements |
Response header
This interface only involves common response headers. For more information, please refer toCommon Request Headers (Common Request Headers).
Return parameters
| Field name | Type | Description |
|---|---|---|
| code | int | Error code |
| msg | string | Error description |
Usage Example
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 error
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 error
{
"code": -1,
"msg": "原密码错误"
}
error code
| Error code | Description |
|---|---|
| 0 | OK |
| -1 | Error, the reason is indicated in msg |
| 1001 | Not logged in |
| 1002 | Not authorized |
| 200 | API request OK |
| 2001 | Original password error |
| 2002 | New password does not meet security requirements |