diff --git a/web-next/app/[locale]/security-history/page.tsx b/web-next/app/[locale]/security-history/page.tsx
index 03eb772..9033cf0 100644
--- a/web-next/app/[locale]/security-history/page.tsx
+++ b/web-next/app/[locale]/security-history/page.tsx
@@ -106,7 +106,7 @@ export default async function SecurityHistoryPage({ params }: { params: Promise<
|
- {c.status}
+
+ {c.statusKey === 'other' ? c.statusRaw : t(`security.webStatus.${c.statusKey}`)}
+
|
{c.ip}
diff --git a/web-next/lib/security-history.ts b/web-next/lib/security-history.ts
index 3226688..652b6fa 100644
--- a/web-next/lib/security-history.ts
+++ b/web-next/lib/security-history.ts
@@ -3,7 +3,7 @@ import { db, DB } from './db'
export interface ActivityEntry {
user: string
- action: string
+ actionKey: string // clave de acción traducible (p.ej. 'tokenRequested')
ip: string
date: Date
}
@@ -13,17 +13,18 @@ export interface RealmConnection {
}
export interface WebConnection {
user: string
- status: string
+ statusKey: 'success' | 'wrongPassword' | 'other'
+ statusRaw: string // texto original (para el caso 'other')
ip: string
date: Date
}
-/** Traduce el estado guardado del intento de login web a la etiqueta del diseño. */
-function webStatusLabel(raw: string): string {
+/** Clasifica el estado guardado del intento de login web en una clave traducible. */
+function webStatusKey(raw: string): 'success' | 'wrongPassword' | 'other' {
const s = (raw || '').toLowerCase()
- if (s.includes('exito') || s.includes('éxito') || s.includes('success')) return 'Conexión exitosa'
- if (s.includes('fracaso') || s.includes('fail') || s.includes('incorrect')) return 'Contraseña incorrecta'
- return raw || '—'
+ if (s.includes('exito') || s.includes('éxito') || s.includes('success')) return 'success'
+ if (s.includes('fracaso') || s.includes('fail') || s.includes('incorrect')) return 'wrongPassword'
+ return 'other'
}
/**
@@ -52,7 +53,7 @@ export async function getSecurityHistory(
[accountId, limit],
)
for (const r of rows) {
- activity.push({ user: displayUser, action: 'Token de seguridad solicitado', ip: String(r.ip_address || '—'), date: new Date(r.created_at) })
+ activity.push({ user: displayUser, actionKey: 'tokenRequested', ip: String(r.ip_address || '—'), date: new Date(r.created_at) })
}
} catch {
/* tabla ausente */
@@ -93,7 +94,8 @@ export async function getSecurityHistory(
[email, limit],
)
for (const r of rows) {
- web.push({ user: displayUser, status: webStatusLabel(String(r.status)), ip: String(r.ip_address || '—'), date: new Date(r.timestamp) })
+ const raw = String(r.status || '')
+ web.push({ user: displayUser, statusKey: webStatusKey(raw), statusRaw: raw, ip: String(r.ip_address || '—'), date: new Date(r.timestamp) })
}
} catch {
/* tabla ausente */
diff --git a/web-next/messages/en.json b/web-next/messages/en.json
index d516a4f..cba0809 100644
--- a/web-next/messages/en.json
+++ b/web-next/messages/en.json
@@ -1058,7 +1058,14 @@
"thUser": "User",
"thAction": "Action",
"thStatus": "Status",
- "thDate": "Date"
+ "thDate": "Date",
+ "action": {
+ "tokenRequested": "Security token requested"
+ },
+ "webStatus": {
+ "success": "Successful login",
+ "wrongPassword": "Wrong password"
+ }
}
},
"Legal": {
diff --git a/web-next/messages/es.json b/web-next/messages/es.json
index f7ee013..88eb3a6 100644
--- a/web-next/messages/es.json
+++ b/web-next/messages/es.json
@@ -1058,7 +1058,14 @@
"thUser": "Usuario",
"thAction": "Acción",
"thStatus": "Estado",
- "thDate": "Fecha"
+ "thDate": "Fecha",
+ "action": {
+ "tokenRequested": "Token de seguridad solicitado"
+ },
+ "webStatus": {
+ "success": "Conexión exitosa",
+ "wrongPassword": "Contraseña incorrecta"
+ }
}
},
"Legal": {
|