feat(audit): add authentication method tracking in audit logs

This commit is contained in:
CaIon
2026-06-13 16:12:22 +08:00
parent 51475c8062
commit 1ac0f5807a
11 changed files with 42 additions and 1 deletions
@@ -473,6 +473,12 @@ export function DetailsDialog(props: DetailsDialogProps) {
if (hasUsername) return String(username)
return `ID: ${id}`
})()
const authMethodLabel = (() => {
if (!isManage || !props.isAdmin || !adminInfo?.auth_method) return ''
if (adminInfo.auth_method === 'access_token') return t('Access Token')
if (adminInfo.auth_method === 'session') return t('Session')
return String(adminInfo.auth_method)
})()
// Localized operation text rendered from the language-independent op
// descriptor (shared by audit type=3 and login type=7).
@@ -806,6 +812,12 @@ export function DetailsDialog(props: DetailsDialogProps) {
{operationText != null && (
<DetailRow label={t('Operation')} value={operationText} />
)}
{authMethodLabel !== '' && (
<DetailRow
label={t('Authentication Method')}
value={authMethodLabel}
/>
)}
{changedFieldsText !== '' && (
<DetailRow
label={t('Changed Fields')}
+1
View File
@@ -110,6 +110,7 @@ export interface LogOtherData {
admin_username?: string
admin_id?: number | string
admin_role?: number
auth_method?: 'session' | 'access_token' | string
}
// Language-independent operation descriptor (audit/login logs).
// Frontend renders localized content from action + params via i18n templates.