From 960db8d64e59d2b6c8910872487bff03b0ec4187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=B4=E5=A4=A9?= Date: Sun, 5 Jul 2026 20:11:59 -0700 Subject: [PATCH] =?UTF-8?q?fix(auth):=20=E6=A1=8C=E9=9D=A2=E7=AB=AF?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AF=86=E7=A0=81=20123456=20=E6=97=B6?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E7=9B=B4=E6=8E=A5=E6=98=8E=E6=96=87?= =?UTF-8?q?=E9=A2=84=E5=A1=AB=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 登录页本就支持默认密码明文预填(首次登录引导),但桌面端只在 mustChangePassword 标记存在时触发——U 盘便携包等预置的 clawpanel.json 只写了 accessPassword: "123456" 而无标记,用户被挡在锁定页且无提示。 判定改为与 security.js / Web 端 auth_check 一致:密码等于出厂值 123456 即视为默认密码,登录页直接预填并提示尽快修改。 Co-Authored-By: Claude Fable 5 --- src/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index d654bff..8986ecc 100644 --- a/src/main.js +++ b/src/main.js @@ -331,8 +331,11 @@ async function checkAuth() { const cfg = await api.readPanelConfig() if (!cfg.accessPassword) return { ok: true } if (sessionStorage.getItem('clawpanel_authed') === '1') return { ok: true } - // 默认密码:直接传给登录页,避免二次读取 - const defaultPw = (cfg.mustChangePassword && cfg.accessPassword) ? cfg.accessPassword : null + // 默认密码:直接传给登录页明文预填提示。判定与 security.js 一致—— + // 密码为出厂值 123456 即视为默认(U 盘便携包等预置配置可能没有 + // mustChangePassword 标记,不能只依赖标记) + const isDefaultPw = cfg.accessPassword === '123456' || !!cfg.mustChangePassword + const defaultPw = isDefaultPw ? cfg.accessPassword : null return { ok: false, defaultPw } } catch { return { ok: true } } }