fix: gate password sessions on the login method so data-source sessions also get the passkey-only page [CI SKIP]

This commit is contained in:
justme committed 2026-10-08 04:09:39 +08:00
1 parent 3b88a3419d
commit 4a3631f82b
2 files changed
+4 -7

No files matched your search

+3 -2
View File
@@ -244,7 +244,8 @@ export function App() {
}
if (!me) return <Login />
// 密码登录的会话没有任何能力:只给它添加 Passkey 的页面
if (me.kind === 'session' && me.auth_method === 'password') return <PasskeyOnly />
// 以数据源方式(会话令牌)连别的后端时 kind 是 token,所以只看登录方式
if (me.auth_method === 'password') return <PasskeyOnly />
return (
<div className="shell">
@@ -271,7 +272,7 @@ export function App() {
<span className="grow">
<div style={{ fontWeight: 600 }}>{me.username ?? 'API 令牌'}</div>
<div className="faint" style={{ fontSize: 12 }}>
{me.kind === 'token' ? `API 令牌 · ${me.capabilities.length} 项能力` : '管理员'}
{me.kind === 'token' && !me.auth_method ? `API 令牌 · ${me.capabilities.length} 项能力` : '管理员'}
</div>
</span>
<ThemeToggle />