Skip to content

修改密码

已登录用户提交当前密码和新密码完成密码修改。新密码与确认密码必须完全一致。修改成功后,建议前端引导用户重新登录以获取新令牌。

项目
Method POST
URL /api/auth/change-password
鉴权 Bearer Token(是)
参数名 类型 必填 说明
old_password string 当前账号密码
new_password string 新密码,8-20 字符
new_password_confirmation string 确认新密码,须与 new_password 完全一致
Terminal window
curl -X POST "https://devapi.fengshengshou.com/api/auth/change-password" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json" \
-d '{
"old_password": "OldPass@123",
"new_password": "NewPass@456",
"new_password_confirmation": "NewPass@456"
}'
字段 类型 说明
code int 0=成功
message string 提示信息
data null 成功时固定为 null
{ "code": 0, "message": "密码修改成功", "data": null }
{ "code": 20004, "message": "旧密码错误", "data": null }
{ "code": 422, "message": "参数校验失败", "data": null }