forked from dsh/panel-auth
refactor: move logout/change-password UI from floating widget to settings
The injected floating buttons overlapped the mobile composer send button. Replace the tapIndex-injected widget with a proper client plugin (panel-auth-ui, ui/ package): registers an account & security section in the panel settings via the settings.section slot, with change-password form and logout action. Host plugin keeps only the /panel-auth/change- password and /panel-auth/logout endpoints. - ui/: ModuleLoader-format client bundle (dsh.client declaration, exports ./client and ./package.json), host no-op stub, bare-package symlink required in the profile node_modules (documented in README). - Host: renderAuthWidget/injectWidget/tapIndex injection removed. - Tests: widget tests removed; change-password flows unchanged.
This commit is contained in:
@@ -88,23 +88,38 @@ dsh.example.com {
|
||||
- panel-auth 的来源校验在 Host 为回环时自动跳过(代理场景);对外域名下的
|
||||
真实跨站提交仍会被拒绝(`非法请求来源`)。
|
||||
|
||||
## 面板内小组件(登出 / 修改密码)
|
||||
## 设置页「账号与安全」(登出 / 修改密码)
|
||||
|
||||
插件通过 `webServer.tapIndex` 在面板页面的右下角注入两个悬浮按钮:
|
||||
配套客户端插件 `panel-auth-ui`(本仓库 `ui/` 目录)在面板**设置**里注册
|
||||
"账号与安全"区块,包含:
|
||||
|
||||
- **退出登录**:跳转 `/panel-auth/logout`,清除 Cookie 并回到登录页。
|
||||
- **修改密码**:弹窗输入当前密码 + 新密码(≥8 位、不得与旧密码相同),
|
||||
- **修改密码**:输入当前密码 + 新密码(≥8 位、不得与旧密码相同),
|
||||
POST 到 `/panel-auth/change-password`:
|
||||
1. 校验会话(Cookie/Basic)与旧密码(错误计入防爆破);
|
||||
2. 生成新 scrypt 哈希,**写回 `patchFilePath`**(cordis.patch.yml,永续);
|
||||
3. 通过 loader 热更新运行配置(`live-updated`,无需重启面板);
|
||||
4. 审计记录 `password-change` 事件(含结果明细)。
|
||||
- **退出登录**:跳转 `/panel-auth/logout`,清除 Cookie 并回到登录页。
|
||||
- 改密不影响已登录会话(签名密钥不变,Cookie 继续有效)。
|
||||
- 新增配置项:
|
||||
```yaml
|
||||
changePasswordPath: '/panel-auth/change-password'
|
||||
patchFilePath: '/root/.dsh/profiles/web/cordis.patch.yml'
|
||||
```
|
||||
|
||||
部署要求(客户端包按裸包名解析):
|
||||
|
||||
```bash
|
||||
# 1. 把 ui/ 目录复制为 profile 内的独立包(host 存根 + client bundle)
|
||||
cp -r ui /root/.dsh/profiles/web/panel-auth-ui
|
||||
# 2. 建立裸包名解析符号链接(profiles 级 node_modules 为 pnpm 布局)
|
||||
ln -sfn ../web/panel-auth-ui /root/.dsh/profiles/node_modules/panel-auth-ui
|
||||
# 3. cordis.patch.yml 增加行(dsh.client 由 package.json 声明驱动)
|
||||
# - id: panel-auth-ui
|
||||
# name: 'panel-auth-ui'
|
||||
```
|
||||
|
||||
相关配置项:
|
||||
|
||||
```yaml
|
||||
changePasswordPath: '/panel-auth/change-password'
|
||||
patchFilePath: '/root/.dsh/profiles/web/cordis.patch.yml'
|
||||
```
|
||||
|
||||
## 修改密码(命令行)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user