From c6043db19779725c0de0e162b0efac3092278a40 Mon Sep 17 00:00:00 2001 From: aiyimickey <39365912+aiyimickey@users.noreply.github.com> Date: Thu, 2 Jul 2026 11:25:26 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97?= =?UTF-8?q?=20schema=20=E5=8F=8A=E7=99=BB=E5=BD=95=E9=A1=B5=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/audit/audit-schema.ts | 1 + ui/login-page.tsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/audit/audit-schema.ts b/lib/audit/audit-schema.ts index e0cb831..f069f0a 100644 --- a/lib/audit/audit-schema.ts +++ b/lib/audit/audit-schema.ts @@ -4,6 +4,7 @@ CREATE TABLE IF NOT EXISTS audit_logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER REFERENCES users(id), username TEXT, + api_key_id INTEGER, action TEXT NOT NULL, entity_type TEXT NOT NULL, entity_id INTEGER, diff --git a/ui/login-page.tsx b/ui/login-page.tsx index 164d0d4..0572270 100644 --- a/ui/login-page.tsx +++ b/ui/login-page.tsx @@ -5,9 +5,10 @@ import { useState } from 'react' interface LoginPageProps { siteName: string // 站点名称,如 "IT 工单跟踪系统"、"告警监控中心" title?: string // 副标题(可选),如 "monitor-ai" + redirectPath?: string // 登录后跳转路径,默认 "/" } -export default function LoginPage({ siteName, title }: LoginPageProps) { +export default function LoginPage({ siteName, title, redirectPath = '/' }: LoginPageProps) { const [username, setUsername] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') @@ -26,7 +27,7 @@ export default function LoginPage({ siteName, title }: LoginPageProps) { if (!res.ok) { setError(data.error || '登录失败'); return } const params = new URLSearchParams(window.location.search) const redirect = params.get('redirect') - const dest = (redirect && redirect.startsWith('/')) ? redirect : '/' + const dest = (redirect && redirect.startsWith('/')) ? redirect : redirectPath window.location.href = dest } catch { setError('网络错误') } finally { setLoading(false) } }