feat: 安全设置其它有效会话也标在线

本机仍为「当前在线」,Chrome/Edge 等同时登录的其它会话显示「在线」并可剔除。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-18 01:59:49 +08:00
parent 3a7bfe59df
commit b3a4b8bb03
3 changed files with 8 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ function DeviceIcon({ kind }: { kind: LoginDevice["device_kind"] }) {
/**
* 安全设置:仍有效的登录会话。
* 本机标「当前在线」;其它设备可剔除,对方需重新输入密码登录。
* 本机标「当前在线」;其它仍有效会话标「在线」,并可剔除。
*/
export default function LoginDevices({ devices: initial }: { devices: LoginDevice[] }) {
const router = useRouter();
@@ -94,14 +94,13 @@ export default function LoginDevices({ devices: initial }: { devices: LoginDevic
<p className="text-[12px] tabular-nums leading-snug" style={{ color: "var(--ink-3)" }}>
{formatDateTime(d.created_at)}
</p>
{d.current ? (
<p className="mt-1 text-[12px] font-semibold" style={{ color: "var(--ok)" }}>
当前在线
</p>
) : (
<p className="mt-1 text-[12px] font-semibold" style={{ color: "var(--ok)" }}>
{d.current ? "当前在线" : "在线"}
</p>
{!d.current && (
<button
type="button"
className="mt-1 text-[12px] font-semibold hover:underline"
className="mt-0.5 text-[12px] font-semibold hover:underline"
style={{ color: "var(--danger)" }}
onClick={() => {
setError("");

View File

@@ -460,7 +460,7 @@ export default async function UserPage({ params, searchParams }: UserPageProps)
{effectiveTab === "security" && (
<li className="flex gap-2">
<span className="shrink-0 mt-px" style={{ color: "var(--accent)" }}>·</span>
<span>「当前在线」是你正在使用的这台设备。其它记录可剔除,对方需重新输入密码才能登录。</span>
<span>「当前在线」是你正在看的这台设备;其它仍有效的登录标「在线」,可剔除后需重新输入密码。</span>
</li>
)}
</ul>