From bcb81719ce0ffaeef43d58b25c355a10a28c9562 Mon Sep 17 00:00:00 2001 From: weichen Date: Fri, 16 Oct 2026 07:15:43 +0000 Subject: [PATCH] Drop the login-key issue client and fix hint punctuation Why: independent review flagged the issue client still targeting the 410 endpoint and a hint sentence ending with a period. Evidence: npm run build + npm test re-run on the fix (SELF). Impact: api client surface only. Refs: review brief /tmp/review-brief-admin-user-contract.md --- src/api.ts | 3 +-- src/components/adminSections.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api.ts b/src/api.ts index 890a29b..d83542d 100644 --- a/src/api.ts +++ b/src/api.ts @@ -86,9 +86,8 @@ export const api = { listAdminUsers: () => auth.fetch(`${BASE}/api/admin/users`).then(r => json<{ owner: string; name: string; isAdmin: boolean; mustChangePassword: boolean; hasPassword: boolean; passwordSetAt?: string; createdAt: string }[]>(r)), // 建号只创建待初始化账号(无密码、无权限位);初始凭证由服务器本地 CLI 发放激活 Key。 createAdminUser: (owner: string, name: string) => auth.fetch(`${BASE}/api/admin/users`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ owner, profile: { name } }) }).then(r => json<{ owner: string; initializationState: string }>(r)), - // ---- 管理员:一次性登录 Key(HTTP 签发端点已被恢复提案契约替换为 410; + // ---- 管理员:一次性登录 Key(HTTP 签发端点已被恢复提案契约替换为 410,客户端方法随之移除; // list/revoke 仍有效,供恢复提案视图复用;兑换入口不变)---- - adminIssueLoginKey: (owner: string, ttlMinutes?: number) => auth.fetch(`${BASE}/api/admin/users/${encodeURIComponent(owner)}/login-keys`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ purpose: 'recover', ...(ttlMinutes ? { ttlMinutes } : {}) }) }).then(r => json<{ id: string; owner: string; purpose: string; status: string; expiresAt: string; key: string }>(r)), adminListLoginKeys: (owner: string) => auth.fetch(`${BASE}/api/admin/users/${encodeURIComponent(owner)}/login-keys`).then(r => json<{ keys: { id: string; owner: string; purpose: string; status: string; expiresAt: string; createdAt: string; createdBy?: string }[] }>(r)).then(d => d.keys ?? []), adminRevokeLoginKey: (owner: string, id: string) => auth.fetch(`${BASE}/api/admin/users/${encodeURIComponent(owner)}/login-keys/${encodeURIComponent(id)}`, { method: 'DELETE' }).then(r => json<{ ok: boolean }>(r)), adminExecEnv: () => auth.fetch(`${BASE}/api/admin/exec-env`).then(r => json(r)), diff --git a/src/components/adminSections.tsx b/src/components/adminSections.tsx index fd687f6..1afe886 100644 --- a/src/components/adminSections.tsx +++ b/src/components/adminSections.tsx @@ -49,7 +49,7 @@ export function UsersPanel() { setName(e.target.value)} /> -

账号创建后处于待初始化状态:在服务器执行 user initialize-account 发放一次性激活 Key,用户经兑换入口设置密码后登录。

+

账号创建后处于待初始化状态:在服务器执行 user initialize-account 发放一次性激活 Key,用户经兑换入口设置密码后登录

)} {notice &&
{notice}
}