SetHasPwd
为网站设置基于 HTTP Basic Auth 的密码访问保护。
- 路由:
POST /site - action:
SetHasPwd
输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| action | 是 | String | 固定值 SetHasPwd |
| id | 是 | Integer | 网站 ID |
| username | 是 | String | 访问用户名 |
| password | 是 | String | 密码(不超过 8 位) |
密码限制 8 位,超过部分无法验证。
相关接口
- GetHasPwd — 查看密码保护状态
- CloseHasPwd — 关闭密码保护
输出参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| status | Boolean | true 表示设置成功 |
| msg | String | 提示信息 |
示例
请求
POST /site HTTP/1.1
Content-Type: application/x-www-form-urlencoded
action=SetHasPwd&id=1&username=admin&password=Test2024
响应
{"status": true, "msg": "设置成功"}