修改密码

OpenAPI 契约

方法
PUT
路径
/api/v1/user/password
认证
jwtBearer (bearer)
响应状态
200 400 401 403 429 500
请求与响应 Schema
JSON
{
  "requestBody": {
    "application/json": {
      "$ref": "#/components/schemas/ChangePasswordRequest"
    }
  },
  "responses": {
    "200": {
      "description": "Password changed",
      "content": {
        "application/json": {}
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

PUT /api/v1/user/password 仅限 JWT。提交非空的 currentPassword 和 newPassword;新密码长度必须为 6–100。服务会确认密码已修改。

修改成功后,所有现有访问令牌和刷新令牌都会失效,包括当前浏览器中的令牌。请清除本地会话,并使用新密码重新登录。

nfy_ 自动化密钥不能修改密码。不得记录、存储或在 HTTPS 请求之外发送任一密码。当前密码错误会以 current-password 错误拒绝,校验失败同样会被拒绝。

http
PUT /api/v1/user/password
Authorization: Bearer <access token>
Content-Type: application/json