{
  "tags": [
    "账户资料"
  ],
  "description": "更新当前登录用户的账户资料、登录安全设置或密码。未登录不能操作。修改手机号或邮箱时分别必须提供针对新号码或新邮箱的验证码；用户名只能在当前用户名为空时设置一次，之后不可修改。",
  "operationId": "user_put_v1_user",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "请求已被处理。成功时 `code` 为 0、`msg` 为“修改成功”、`data` 为 null；未登录、验证码错误、资料重复或格式不正确时仍返回 HTTP 200。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "code",
              "msg",
              "data"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "description": "业务状态码；成功为 0。",
                "example": 0
              },
              "msg": {
                "type": "string",
                "description": "处理结果说明。",
                "example": "修改成功"
              },
              "data": {
                "type": "string",
                "nullable": true,
                "description": "成功时为 null；失败时为空字符串。",
                "example": null
              }
            }
          },
          "examples": {
            "success": {
              "summary": "修改成功",
              "value": {
                "code": 0,
                "msg": "修改成功",
                "data": null
              }
            },
            "emailCaptchaRequired": {
              "summary": "缺少邮箱验证码",
              "value": {
                "code": "user-41",
                "msg": "请输入邮箱验证码",
                "data": ""
              }
            },
            "notLoggedIn": {
              "summary": "未登录",
              "value": {
                "code": "user-49",
                "msg": "请登录",
                "data": ""
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "修改成功",
            "data": null
          }
        }
      }
    }
  },
  "x-python-handler": "user.UserAPI",
  "x-python-route-line": 185,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "description": "用户名。仅当当前用户名为空时可设置一次；只允许中文、英文字母与数字，且不能重复或为手机号。"
            },
            "phone": {
              "type": "string",
              "description": "新手机号，必须合法且未被其他用户使用；传入时必须同时提供 `phone_captcha`。",
              "example": "13800000000"
            },
            "phone_captcha": {
              "type": "string",
              "description": "修改手机号时必填。发送到新手机号的验证码。",
              "example": "123456"
            },
            "email": {
              "type": "string",
              "format": "email",
              "description": "新邮箱，必须合法且未被其他用户使用；传入时必须同时提供 `captcha`。",
              "example": "new@example.invalid"
            },
            "captcha": {
              "type": "string",
              "description": "修改邮箱时必填。发送到新邮箱的验证码。",
              "example": "123456"
            },
            "qq": {
              "type": "string",
              "description": "新 QQ 号，必须为合法 QQ 号。",
              "example": "10001"
            },
            "white_ip": {
              "type": "string",
              "description": "登录 IP 白名单，多个 IP 使用空白字符分隔；可传空字符串清空。",
              "example": "192.0.2.10 198.51.100.20"
            },
            "login_captcha": {
              "type": "string",
              "enum": [
                "",
                "sms",
                "email"
              ],
              "description": "登录二次验证码方式；空字符串表示关闭。`sms` 要求系统允许且已绑定手机，`email` 要求系统允许且已绑定邮箱。",
              "example": "email"
            },
            "password": {
              "type": "string",
              "format": "password",
              "minLength": 6,
              "description": "新密码，至少 6 位且必须同时包含英文字母与数字。",
              "example": "NewPass123"
            }
          },
          "example": {
            "email": "new@example.invalid",
            "captcha": "123456",
            "white_ip": "192.0.2.10",
            "login_captcha": "email"
          }
        }
      }
    }
  },
  "parameters": [],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "user.UserAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 185
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "put",
  "path": "/v1/user",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "AccessToken": {
      "type": "apiKey",
      "in": "header",
      "name": "access-token",
      "description": "通过登录接口获得的短期访问令牌。"
    },
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "api-key",
      "description": "API Key；必须和 api-secret 同时发送。"
    },
    "ApiSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "api-secret",
      "description": "API Secret；必须和 api-key 同时发送。"
    }
  },
  "jsonRequestBodyExample": {
    "email": "new@example.invalid",
    "captcha": "123456",
    "white_ip": "192.0.2.10",
    "login_captcha": "email"
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "更新当前用户信息",
    "description": {
      "content": "更新当前登录用户的账户资料、登录安全设置或密码。未登录不能操作。修改手机号或邮箱时分别必须提供针对新号码或新邮箱的验证码；用户名只能在当前用户名为空时设置一次，之后不可修改。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "user"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": []
    },
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "PUT",
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}