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) } }