mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-07-13 00:11:52 +08:00
fix(auth): 桌面端默认密码 123456 时登录页直接明文预填提示
登录页本就支持默认密码明文预填(首次登录引导),但桌面端只在 mustChangePassword 标记存在时触发——U 盘便携包等预置的 clawpanel.json 只写了 accessPassword: "123456" 而无标记,用户被挡在锁定页且无提示。 判定改为与 security.js / Web 端 auth_check 一致:密码等于出厂值 123456 即视为默认密码,登录页直接预填并提示尽快修改。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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 } }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user