mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-23 08:55:25 +00:00
7728e5ea9e
Add a new settings page under Settings > Sessions that shows all active and expired login sessions with user info, IP address, device, and an option to revoke (force logout) any session. Backend: - listSessions: adminProcedure that returns sessions joined with user data, ordered by creation date - revokeSession: adminProcedure that deletes a session by ID (blocks self-revocation) Frontend: - New /dashboard/settings/sessions page with ShowSessions component - Sessions table with user, IP, device, timestamps, and revoke action - Sidebar link under Users (gated by member.read permission) Tests: - Input validation tests for revokeSession schema
24 lines
646 B
TypeScript
24 lines
646 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { z } from "zod";
|
|
|
|
const revokeSessionSchema = z.object({
|
|
sessionId: z.string(),
|
|
});
|
|
|
|
describe("revokeSession input validation", () => {
|
|
it("accepts a valid session id", () => {
|
|
const result = revokeSessionSchema.safeParse({ sessionId: "abc123" });
|
|
expect(result.success).toBe(true);
|
|
});
|
|
|
|
it("rejects missing sessionId", () => {
|
|
const result = revokeSessionSchema.safeParse({});
|
|
expect(result.success).toBe(false);
|
|
});
|
|
|
|
it("rejects non-string sessionId", () => {
|
|
const result = revokeSessionSchema.safeParse({ sessionId: 123 });
|
|
expect(result.success).toBe(false);
|
|
});
|
|
});
|