chore: 审计日志 schema 及登录页组件微调
This commit is contained in:
parent
8f473c2b6c
commit
c6043db197
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue