⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(admin): manage user sessions and API keys
Tin3da34caa8bf9
diff --git a/apps/api/src/admin/controllers/list-user-api-keys.ts b/apps/api/src/admin/controllers/list-user-api-keys.tsnew file mode 100644index 000000000..d892cad29--- /dev/null+++ b/apps/api/src/admin/controllers/list-user-api-keys.ts@@ -0,0 +1,38 @@+import { desc, eq } from "drizzle-orm";+import db from "../../database";+import { apikeyTable } from "../../database/schema";+import { findAdminTargetUser } from "../find-admin-target-user";++const iso = (date: Date | null) => (date ? date.toISOString() : null);++/** A user's API keys as metadata only: never the key or its hash. */+async function listUserApiKeys(userId: string) {+ await findAdminTargetUser(db, userId);+ const rows = await db+ .select({+ id: apikeyTable.id,+ name: apikeyTable.name,+ start: apikeyTable.start,+ enabled: apikeyTable.enabled,+ createdAt: apikeyTable.createdAt,+ lastRequest: apikeyTable.lastRequest,+ expiresAt: apikeyTable.expiresAt,+ })+ .from(apikeyTable)+ .where(eq(apikeyTable.referenceId, userId))+ .orderBy(desc(apikeyTable.createdAt), desc(apikeyTable.id));++ return {+ apiKeys: rows.map((row) => ({+ id: row.id,+ name: row.name,+ start: row.start,+ enabled: row.enabled ?? true,+ createdAt: row.createdAt.toISOString(),+ lastUsedAt: iso(row.lastRequest),+ expiresAt: iso(row.expiresAt),+ })),+ };+}++export default listUserApiKeys;diff --git a/apps/api/src/admin/controllers/list-user-sessions.ts b/apps/api/src/admin/controllers/list-user-sessions.tsnew file mode 100644index 000000000..19a561b2d--- /dev/null+++ b/apps/api/src/admin/controllers/list-user-sessions.ts@@ -0,0 +1,10 @@+import db from "../../database";+import { listActiveSessions } from "../../sessions/list-active-sessions";+import { findAdminTargetUser } from "../find-admin-target-user";++async function listUserSessions(userId: string, adminSessionId: string | null) {+ await findAdminTargetUser(db, userId);+ return listActiveSessions(userId, adminSessionId);+}++export default listUserSessions;diff --git a/apps/api/src/admin/controllers/revoke-user-api-key.ts b/apps/api/src/admin/controllers/revoke-user-api-key.tsnew file mode 100644index 000000000..7693cab8f--- /dev/null+++ b/apps/api/src/admin/controllers/revoke-user-api-key.ts@@ -0,0 +1,41 @@+import { and, eq } from "drizzle-orm";+import { HTTPException } from "hono/http-exception";+import db from "../../database";+import { apikeyTable } from "../../database/schema";+import type { AdminAuditRequest } from "../audit/admin-audit-request";+import { recordAdminAction } from "../audit/record-admin-action";+import { findAdminTargetUser } from "../find-admin-target-user";++/**+ * Delete a user's API key, as the owner's own settings do. Requests with it+ * fail at once; open sockets stop receiving events at the next delivery check.+ */+async function revokeUserApiKey(+ { userId, apiKeyId }: { userId: string; apiKeyId: string },+ audit: AdminAuditRequest,+) {+ await db.transaction(async (tx) => {+ const user = await findAdminTargetUser(tx, userId);+ const [key] = await tx+ .delete(apikeyTable)+ .where(+ and(eq(apikeyTable.id, apiKeyId), eq(apikeyTable.referenceId, userId)),+ )+ .returning({ id: apikeyTable.id, name: apikeyTable.name });+ if (!key) throw new HTTPException(404, { message: "API key not found" });+ await recordAdminAction(+ {+ ...audit,+ action: "api_key.revoked",+ targetType: "user",+ targetId: user.id,+ targetLabel: user.email,+ metadata: { keyId: key.id, keyName: key.name },+ },+ tx,+ );+ });+ return { revoked: 1 };+}++export default revokeUserApiKey;diff --git a/apps/api/src/admin/controllers/revoke-user-session.ts b/apps/api/src/admin/controllers/revoke-user-session.tsnew file mode 100644index 000000000..f529195ec--- /dev/null+++ b/apps/api/src/admin/controllers/revoke-user-session.ts@@ -0,0 +1,42 @@+import { HTTPException } from "hono/http-exception";+import db from "../../database";+import { deleteUserSessions } from "../../sessions/delete-user-sessions";+import { revokeSessionConnections } from "../../ws";+import type { AdminAuditRequest } from "../audit/admin-audit-request";+import { recordAdminAction } from "../audit/record-admin-action";+import { findAdminTargetUser } from "../find-admin-target-user";++async function revokeUserSession(+ { userId, sessionId }: { userId: string; sessionId: string },+ adminSessionId: string | null,+ audit: AdminAuditRequest,+) {+ if (sessionId === adminSessionId) {+ throw new HTTPException(409, {+ message: "Sign out to end your current session",+ });+ }+ const revoked = await db.transaction(async (tx) => {+ const user = await findAdminTargetUser(tx, userId);+ const ids = await deleteUserSessions(tx, userId, { sessionId });+ if (ids.length === 0) {+ throw new HTTPException(404, { message: "Session not found" });+ }+ await recordAdminAction(+ {+ ...audit,+ action: "session.revoked",+ targetType: "user",+ targetId: user.id,+ targetLabel: user.email,+ metadata: { sessionId },+ },+ tx,+ );+ return ids;+ });+ await revokeSessionConnections(userId, revoked);+ return { revoked: revoked.length };+}++export default revokeUserSession;diff --git a/apps/api/src/admin/controllers/revoke-user-sessions.ts b/apps/api/src/admin/controllers/revoke-user-sessions.tsnew file mode 100644index 000000000..9ad4f6035--- /dev/null+++ b/apps/api/src/admin/controllers/revoke-user-sessions.ts@@ -0,0 +1,38 @@+import db from "../../database";+import { deleteUserSessions } from "../../sessions/delete-user-sessions";+import { revokeSessionConnections } from "../../ws";+import type { AdminAuditRequest } from "../audit/admin-audit-request";+import { recordAdminAction } from "../audit/record-admin-action";+import { findAdminTargetUser } from "../find-admin-target-user";++/** Sign a user out everywhere. An admin's own current session is kept. */+async function revokeUserSessions(+ userId: string,+ adminSessionId: string | null,+ audit: AdminAuditRequest,+) {+ const revoked = await db.transaction(async (tx) => {+ const user = await findAdminTargetUser(tx, userId);+ const ids = await deleteUserSessions(tx, userId, {+ exceptSessionId: adminSessionId,+ });+ if (ids.length > 0) {+ await recordAdminAction(+ {+ ...audit,+ action: "session.revoked_all",+ targetType: "user",+ targetId: user.id,+ targetLabel: user.email,+ metadata: { count: ids.length },+ },+ tx,+ );+ }+ return ids;+ });+ await revokeSessionConnections(userId, revoked);+ return { revoked: revoked.length };+}++export default revokeUserSessions;diff --git a/apps/api/src/admin/find-admin-target-user.ts b/apps/api/src/admin/find-admin-target-user.tsnew file mode 100644index 000000000..ee0da29c4--- /dev/null+++ b/apps/api/src/admin/find-admin-target-user.ts@@ -0,0 +1,15 @@+import { eq } from "drizzle-orm";+import { HTTPException } from "hono/http-exception";+import { schema } from "../database";+import type { DbOrTx } from "../project-access/db-or-tx";++/** The user an admin action is about, or a 404. */+export async function findAdminTargetUser(database: DbOrTx, userId: string) {+ const [user] = await database+ .select({ id: schema.userTable.id, email: schema.userTable.email })+ .from(schema.userTable)+ .where(eq(schema.userTable.id, userId))+ .limit(1);+ if (!user) throw new HTTPException(404, { message: "User not found" });+ return user;+}diff --git a/apps/api/src/admin/index.ts b/apps/api/src/admin/index.tsindex e0a144d66..1f1d8b4f3 100644--- a/apps/api/src/admin/index.ts+++ b/apps/api/src/admin/index.ts@@ -34,6 +34,7 @@ import {transferAdminWorkspaceOwnershipBody,updateAdminWorkspaceMemberRoleBody,} from "./schema";+import { adminUserSecurityRoutes } from "./user-security-routes";const forbidden = errorResponse("The caller is not an instance administrator or is authenticated with an API key",@@ -290,6 +291,7 @@ const admin = apiRouter().openapi(listAuditLogRoute, async (c) =>c.json(await listAuditLog(c.req.valid("query")), 200),)- .route("/users", adminUserRoutes);+ .route("/users", adminUserRoutes)+ .route("/", adminUserSecurityRoutes);export default admin;diff --git a/apps/api/src/admin/user-security-routes.ts b/apps/api/src/admin/user-security-routes.tsnew file mode 100644index 000000000..20e036b51--- /dev/null+++ b/apps/api/src/admin/user-security-routes.ts@@ -0,0 +1,155 @@+import {+ apiRouter,+ createRoute,+ errorResponse,+ jsonResponse,+} from "../openapi";+import {+ activeSessionListSchema,+ revokedSessionsSchema,+} from "../sessions/response";+import { requireInstanceAdmin } from "../utils/require-instance-admin";+import { requireUserSession } from "../utils/require-user-session";+import { adminAuditRequest } from "./audit/admin-audit-request";+import listUserApiKeys from "./controllers/list-user-api-keys";+import listUserSessions from "./controllers/list-user-sessions";+import revokeUserApiKey from "./controllers/revoke-user-api-key";+import revokeUserSession from "./controllers/revoke-user-session";+import revokeUserSessions from "./controllers/revoke-user-sessions";+import {+ adminApiKeyListSchema,+ adminRevokedApiKeySchema,+ adminUserApiKeyParam,+ adminUserParam,+ adminUserSessionParam,+} from "./user-security-schema";++const forbidden = errorResponse(+ "The caller is not an instance administrator or is authenticated with an API key",+);++const listSessionsRoute = createRoute({+ method: "get",+ operationId: "listAdminUserSessions",+ path: "/users/{userId}/sessions",+ tags: ["Admin"],+ summary: "List a user's sessions",+ description:+ "List a user's signed-in sessions with device, IP address, and activity. Tokens are never returned. `current` marks the administrator's own session. Requires an instance administrator session; API keys are rejected.",+ middleware: [requireUserSession, requireInstanceAdmin] as const,+ request: { params: adminUserParam },+ responses: {+ 200: jsonResponse("Active sessions", activeSessionListSchema),+ 403: forbidden,+ 404: errorResponse("User not found"),+ },+});++const revokeSessionRoute = createRoute({+ method: "delete",+ operationId: "revokeAdminUserSession",+ path: "/users/{userId}/sessions/{sessionId}",+ tags: ["Admin"],+ summary: "Sign out one of a user's sessions",+ description:+ "End one session immediately, including its realtime connections, and record it in the audit log. The administrator's own current session can't be ended here; sign out instead.",+ middleware: [requireUserSession, requireInstanceAdmin] as const,+ request: { params: adminUserSessionParam },+ responses: {+ 200: jsonResponse("Session signed out", revokedSessionsSchema),+ 403: forbidden,+ 404: errorResponse("User or session not found"),+ 409: errorResponse("The session is the administrator's current session"),+ },+});++const revokeSessionsRoute = createRoute({+ method: "delete",+ operationId: "revokeAdminUserSessions",+ path: "/users/{userId}/sessions",+ tags: ["Admin"],+ summary: "Sign out all of a user's sessions",+ description:+ "End every session of a user immediately, including realtime connections, and record it in the audit log. When administrators target themselves, their current session is kept. API keys keep working; revoke them separately.",+ middleware: [requireUserSession, requireInstanceAdmin] as const,+ request: { params: adminUserParam },+ responses: {+ 200: jsonResponse("Sessions signed out", revokedSessionsSchema),+ 403: forbidden,+ 404: errorResponse("User not found"),+ },+});++const listApiKeysRoute = createRoute({+ method: "get",+ operationId: "listAdminUserApiKeys",+ path: "/users/{userId}/api-keys",+ tags: ["Admin"],+ summary: "List a user's API keys",+ description:+ "List a user's API keys with their name, start, status, and dates. The key and its hash are never returned. Requires an instance administrator session; API keys are rejected.",+ middleware: [requireUserSession, requireInstanceAdmin] as const,+ request: { params: adminUserParam },+ responses: {+ 200: jsonResponse("API keys, newest first", adminApiKeyListSchema),+ 403: forbidden,+ 404: errorResponse("User not found"),+ },+});++const revokeApiKeyRoute = createRoute({+ method: "delete",+ operationId: "revokeAdminUserApiKey",+ path: "/users/{userId}/api-keys/{apiKeyId}",+ tags: ["Admin"],+ summary: "Revoke a user's API key",+ description:+ "Delete a user's API key so it stops working immediately, and record it in the audit log.",+ middleware: [requireUserSession, requireInstanceAdmin] as const,+ request: { params: adminUserApiKeyParam },+ responses: {+ 200: jsonResponse("API key revoked", adminRevokedApiKeySchema),+ 403: forbidden,+ 404: errorResponse("User or API key not found"),+ },+});++export const adminUserSecurityRoutes = apiRouter()+ .openapi(listSessionsRoute, async (c) =>+ c.json(+ await listUserSessions(+ c.req.valid("param").userId,+ c.get("session")?.id ?? null,+ ),+ 200,+ ),+ )+ .openapi(revokeSessionRoute, async (c) =>+ c.json(+ await revokeUserSession(+ c.req.valid("param"),+ c.get("session")?.id ?? null,+ adminAuditRequest(c),+ ),+ 200,+ ),+ )+ .openapi(revokeSessionsRoute, async (c) =>+ c.json(+ await revokeUserSessions(+ c.req.valid("param").userId,+ c.get("session")?.id ?? null,+ adminAuditRequest(c),+ ),+ 200,+ ),+ )+ .openapi(listApiKeysRoute, async (c) =>+ c.json(await listUserApiKeys(c.req.valid("param").userId), 200),+ )+ .openapi(revokeApiKeyRoute, async (c) =>+ c.json(+ await revokeUserApiKey(c.req.valid("param"), adminAuditRequest(c)),+ 200,+ ),+ );diff --git a/apps/api/src/admin/user-security-schema.ts b/apps/api/src/admin/user-security-schema.tsnew file mode 100644index 000000000..99511ccb3--- /dev/null+++ b/apps/api/src/admin/user-security-schema.ts@@ -0,0 +1,34 @@+import { z } from "../openapi";++const id = z.string().min(1).max(200);++export const adminUserParam = z.object({ userId: id });++export const adminUserSessionParam = z.object({ userId: id, sessionId: id });++export const adminUserApiKeyParam = z.object({ userId: id, apiKeyId: id });++const isoTimestamp = z.string().openapi({ format: "date-time" });++export const adminApiKeySchema = z+ .object({+ id: z.string(),+ name: z.string().nullable(),+ start: z.string().nullable().openapi({+ description:+ "The first characters of the key, kept for recognizing it. The key itself and its hash are never returned.",+ }),+ enabled: z.boolean(),+ createdAt: isoTimestamp,+ lastUsedAt: isoTimestamp.nullable(),+ expiresAt: isoTimestamp.nullable(),+ })+ .openapi("AdminApiKey");++export const adminApiKeyListSchema = z+ .object({ apiKeys: z.array(adminApiKeySchema) })+ .openapi("AdminApiKeyList");++export const adminRevokedApiKeySchema = z+ .object({ revoked: z.number().int() })+ .openapi("AdminRevokedApiKey");diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.tsindex 5d74b4154..0dcb71476 100644--- a/apps/api/src/auth.ts+++ b/apps/api/src/auth.ts@@ -1,4 +1,8 @@-import { revokeUserConnections, revokeWorkspaceConnections } from "./ws";+import {+ revokeSessionConnections,+ revokeUserConnections,+ revokeWorkspaceConnections,+} from "./ws";import { apiKey } from "@better-auth/api-key";import {isSmtpConfigured,@@ -864,6 +868,13 @@ export const auth = betterAuth({if (oidcSid) return { data: { oidcSid } };},},+ delete: {+ // Sign-out, revoking other sessions, password resets and deactivation+ // all end sessions here; close their realtime connections right away.+ after: async (session) => {+ await revokeSessionConnections(session.userId, [session.id]);+ },+ },},},hooks: {diff --git a/apps/api/src/sessions/delete-user-sessions.ts b/apps/api/src/sessions/delete-user-sessions.tsnew file mode 100644index 000000000..548c5ca74--- /dev/null+++ b/apps/api/src/sessions/delete-user-sessions.ts@@ -0,0 +1,37 @@+import { and, eq, ne } from "drizzle-orm";+import { schema } from "../database";+import type { DbOrTx } from "../project-access/db-or-tx";++type Which = { sessionId: string } | { exceptSessionId: string | null };++/**+ * Delete one or all of a user's sessions and return the deleted ids. Locks the+ * user row first, the same order the auth adapter and MCP redemption use.+ */+export async function deleteUserSessions(+ tx: DbOrTx,+ userId: string,+ which: Which,+) {+ await tx+ .select({ id: schema.userTable.id })+ .from(schema.userTable)+ .where(eq(schema.userTable.id, userId))+ .for("update");++ const session = schema.sessionTable;+ const deleted = await tx+ .delete(session)+ .where(+ and(+ eq(session.userId, userId),+ "sessionId" in which+ ? eq(session.id, which.sessionId)+ : which.exceptSessionId+ ? ne(session.id, which.exceptSessionId)+ : undefined,+ ),+ )+ .returning({ id: session.id });+ return deleted.map((row) => row.id);+}diff --git a/apps/api/src/sessions/list-active-sessions.ts b/apps/api/src/sessions/list-active-sessions.tsnew file mode 100644index 000000000..9284e194b--- /dev/null+++ b/apps/api/src/sessions/list-active-sessions.ts@@ -0,0 +1,48 @@+import { and, desc, eq, gt } from "drizzle-orm";+import db from "../database";+import { sessionTable } from "../database/schema";+import { parseUserAgent } from "../utils/parse-user-agent";++/** A user's unexpired sessions, the caller's own first. Never includes tokens. */+export async function listActiveSessions(+ userId: string,+ currentSessionId: string | null,+) {+ const rows = await db+ .select({+ id: sessionTable.id,+ userAgent: sessionTable.userAgent,+ ipAddress: sessionTable.ipAddress,+ createdAt: sessionTable.createdAt,+ updatedAt: sessionTable.updatedAt,+ expiresAt: sessionTable.expiresAt,+ })+ .from(sessionTable)+ .where(+ and(+ eq(sessionTable.userId, userId),+ gt(sessionTable.expiresAt, new Date()),+ ),+ )+ .orderBy(desc(sessionTable.updatedAt), desc(sessionTable.id));++ const sessions = rows.map((row) => {+ const device = parseUserAgent(row.userAgent);+ return {+ id: row.id,+ browser: device?.browser ?? null,+ os: device?.os ?? null,+ ipAddress: row.ipAddress,+ createdAt: row.createdAt.toISOString(),+ lastActiveAt: row.updatedAt.toISOString(),+ expiresAt: row.expiresAt.toISOString(),+ current: row.id === currentSessionId,+ };+ });+ return {+ sessions: [+ ...sessions.filter((session) => session.current),+ ...sessions.filter((session) => !session.current),+ ],+ };+}diff --git a/apps/api/src/sessions/response.ts b/apps/api/src/sessions/response.tsnew file mode 100644index 000000000..3142dd099--- /dev/null+++ b/apps/api/src/sessions/response.ts@@ -0,0 +1,39 @@+import { z } from "../openapi";++const isoTimestamp = z.string().openapi({ format: "date-time" });++export const activeSessionSchema = z+ .object({+ id: z.string().openapi({+ description: "Session id. Session tokens are never returned.",+ }),+ browser: z.string().nullable().openapi({+ description: "Browser read from the session's user agent, if known.",+ }),+ os: z.string().nullable().openapi({+ description: "Operating system or device read from the user agent.",+ }),+ ipAddress: z.string().nullable(),+ createdAt: isoTimestamp,+ lastActiveAt: isoTimestamp.openapi({+ description:+ "When the session was last refreshed. Sessions refresh about once a day while in use.",+ }),+ expiresAt: isoTimestamp,+ current: z.boolean().openapi({+ description: "True for the session making this request.",+ }),+ })+ .openapi("ActiveSession");++export const activeSessionListSchema = z+ .object({ sessions: z.array(activeSessionSchema) })+ .openapi("ActiveSessionList");++export const revokedSessionsSchema = z+ .object({+ revoked: z.number().int().openapi({+ description: "Number of sessions that were signed out.",+ }),+ })+ .openapi("RevokedSessions");diff --git a/apps/api/src/user/controllers/revoke-own-session.ts b/apps/api/src/user/controllers/revoke-own-session.tsnew file mode 100644index 000000000..6bc2be836--- /dev/null+++ b/apps/api/src/user/controllers/revoke-own-session.ts@@ -0,0 +1,27 @@+import { HTTPException } from "hono/http-exception";+import db from "../../database";+import { deleteUserSessions } from "../../sessions/delete-user-sessions";+import { revokeSessionConnections } from "../../ws";++/** Sign out one of the caller's other sessions. */+async function revokeOwnSession(+ userId: string,+ currentSessionId: string,+ sessionId: string,+) {+ if (sessionId === currentSessionId) {+ throw new HTTPException(409, {+ message: "Sign out to end the current session",+ });+ }+ const revoked = await db.transaction((tx) =>+ deleteUserSessions(tx, userId, { sessionId }),+ );+ if (revoked.length === 0) {+ throw new HTTPException(404, { message: "Session not found" });+ }+ await revokeSessionConnections(userId, revoked);+ return { revoked: revoked.length };+}++export default revokeOwnSession;diff --git a/apps/api/src/user/index.ts b/apps/api/src/user/index.tsindex 184fd838a..240be3d80 100644--- a/apps/api/src/user/index.ts+++ b/apps/api/src/user/index.ts@@ -5,10 +5,17 @@ import {errorResponse,jsonResponse,} from "../openapi";+import {+ activeSessionListSchema,+ revokedSessionsSchema,+} from "../sessions/response";+import { listActiveSessions } from "../sessions/list-active-sessions";import { boundedRequestBody } from "../utils/bounded-request-body";+import { requireUserSession } from "../utils/require-user-session";import { MAX_AVATAR_BYTES, MAX_AVATAR_REQUEST_BYTES } from "./avatar";import deleteAvatar from "./controllers/delete-avatar";import getCurrentUser from "./controllers/get-current-user";+import revokeOwnSession from "./controllers/revoke-own-session";import saveAvatar from "./controllers/save-avatar";import {requireRemovableAvatar,@@ -19,7 +26,7 @@ import {avatarSchema,currentUserSchema,} from "./response";-import { uploadAvatarBody } from "./schema";+import { uploadAvatarBody, userSessionParam } from "./schema";const getCurrentUserRoute = createRoute({method: "get",@@ -84,6 +91,44 @@ const deleteAvatarRoute = createRoute({},});+const listSessionsRoute = createRoute({+ method: "get",+ operationId: "listOwnSessions",+ path: "/sessions",+ tags: ["User"],+ summary: "List your active sessions",+ description:+ "List the current user's signed-in sessions with device, IP address, and activity, marking the one making the request. Tokens are never returned. Requires a user session; API keys are rejected.",+ middleware: [requireUserSession] as const,+ responses: {+ 200: jsonResponse(+ "Active sessions, current first",+ activeSessionListSchema,+ ),+ 401: errorResponse("Unauthorized"),+ 403: errorResponse("Authenticated with an API key"),+ },+});++const revokeSessionRoute = createRoute({+ method: "delete",+ operationId: "revokeOwnSession",+ path: "/sessions/{sessionId}",+ tags: ["User"],+ summary: "Sign out one of your sessions",+ description:+ "End another of the current user's sessions by id and close its realtime connections. To end every other session use better-auth's `POST /api/auth/revoke-other-sessions`; to end the current one, sign out.",+ middleware: [requireUserSession] as const,+ request: { params: userSessionParam },+ responses: {+ 200: jsonResponse("Session signed out", revokedSessionsSchema),+ 401: errorResponse("Unauthorized"),+ 403: errorResponse("Authenticated with an API key"),+ 404: errorResponse("No such session for this user"),+ 409: errorResponse("The session is the one making the request"),+ },+});+const user = apiRouter().openapi(getCurrentUserRoute, async (c) =>c.json(await getCurrentUser(c.get("userId")), 200),@@ -104,6 +149,23 @@ const user = apiRouter()}).openapi(deleteAvatarRoute, async (c) =>c.json(await deleteAvatar(c.get("userId")), 200),- );+ )+ .openapi(listSessionsRoute, async (c) =>+ c.json(+ await listActiveSessions(c.get("userId"), c.get("session")?.id ?? null),+ 200,+ ),+ )+ .openapi(revokeSessionRoute, async (c) => {+ const current = c.get("session")?.id ?? "";+ return c.json(+ await revokeOwnSession(+ c.get("userId"),+ current,+ c.req.valid("param").sessionId,+ ),+ 200,+ );+ });export default user;diff --git a/apps/api/src/user/schema.ts b/apps/api/src/user/schema.tsindex 9057a6d02..1d35db838 100644--- a/apps/api/src/user/schema.ts+++ b/apps/api/src/user/schema.ts@@ -11,3 +11,7 @@ export const uploadAvatarBody = z.object({.max(MAX_AVATAR_INPUT_CHARS).openapi({ description: "Base64 encoded image bytes." }),});++export const userSessionParam = z.object({+ sessionId: z.string().min(1).max(200),+});diff --git a/apps/docs/core/functional/manage-your-account.mdx b/apps/docs/core/functional/manage-your-account.mdxindex eb07224dd..8917cffdb 100644--- a/apps/docs/core/functional/manage-your-account.mdx+++ b/apps/docs/core/functional/manage-your-account.mdx@@ -1,6 +1,6 @@---title: Your account-description: Manage your profile, password, API keys, and account deletion+description: Manage your profile, password, signed-in sessions, API keys, and account deletion---Your profile picture and your account itself are both managed from **Settings → Account → Profile**.@@ -27,6 +27,12 @@ Accounts that sign in only through a provider or passwordless email do not have<img className="hidden dark:block" src="/images/product/security-dark.png" alt="Accounts with a password can change it under Account → Security." /></Frame>+## Review where you're signed in++**Settings → Account → Security** also lists your active sessions: the browser and device, IP address, when you signed in, and when the session was last active. The session you're using is marked **This device**. Sessions refresh about once a day while in use, so "last active" is approximate.++Select **Sign out** on a session you don't recognize to end it, or **Sign out other sessions** to end every session except this one. Ended sessions stop working at once, including open boards that update live. To end the current session, sign out. API keys aren't sessions; delete them under **Settings → Account → API keys**.+## API keysOpen **Settings → Account → API keys** to create or delete credentials for scripts and integrations. Follow [API authentication](/api-reference/authentication) before using a key.diff --git a/apps/docs/core/operations/administration.mdx b/apps/docs/core/operations/administration.mdxindex 857fd2bb7..83be4247f 100644--- a/apps/docs/core/operations/administration.mdx+++ b/apps/docs/core/operations/administration.mdx@@ -25,6 +25,15 @@ Emails need [SMTP](/core/installation/environment-variables#smtp-configuration)If [the identity provider manages profile pictures](/core/social-providers/custom-oauth#managed-profile-fields), you can't replace a user's picture, and you can only remove one they uploaded in Kaneo.+### Sessions and API keys++Choose **Sessions & API keys** from a user's menu to see where they're signed in and which API keys they have.++- **Sessions** show the browser and device, IP address, sign-in time, and last activity. **Sign out** ends one session; **Sign out everywhere** ends all of them. Ended sessions stop working immediately, including open realtime connections. If you open your own account, your current session is marked **This device** and stays signed in; sign out normally to end it.+- **API keys** show the name, the first characters, creation date, last use, expiry, and whether the key is enabled. The key itself is never shown. **Revoke** deletes the key, the same as when its owner deletes it, and requests with it fail right away. Signing a user out doesn't revoke their API keys, and deactivating a user blocks their keys as well.++These actions are recorded in the audit log. The same operations are available to instance administrator sessions under `/api/admin/users/{userId}/sessions` and `/api/admin/users/{userId}/api-keys`; API keys are rejected, and session tokens are never returned.+Deleting someone who is the only owner of a workspace that still has other members is blocked. Transfer that workspace's ownership first, as described below.### Create a user@@ -52,12 +61,13 @@ The only owner can't be removed or given another role. Transfer ownership to som## Review the audit log-Open **Settings → Administration → Audit log** to see what administrators changed, newest first. Each entry shows the action, the administrator who did it, the affected user or workspace, the time, and the IP address the request came from. Filter by users, sessions, or workspaces to narrow the list.+Open **Settings → Administration → Audit log** to see what administrators changed, newest first. Each entry shows the action, the administrator who did it, the affected user or workspace, the time, and the IP address the request came from. Filter by users, sessions, API keys, or workspaces to narrow the list.Kaneo records these actions when they succeed. Rejected or failed attempts aren't recorded.- **Users:** created, details updated (which fields changed), instance role changed, deactivated, reactivated, deleted, password set by an administrator, password reset link sent, verification email sent, email marked verified, profile picture changed or removed, and signed in as the user (impersonation).- **Sessions:** one session or all of a user's sessions revoked.+- **API keys:** a user's API key revoked (its name, never its value).- **Workspaces:** member added, member removed, member role changed, and ownership transferred.The first account becoming an administrator on a new instance isn't an administrative action and isn't recorded.diff --git a/apps/docs/openapi.json b/apps/docs/openapi.jsonindex 68326549b..d7cabdc6c 100644--- a/apps/docs/openapi.json+++ b/apps/docs/openapi.json@@ -5322,6 +5322,88 @@"deleted"]},+ "ActiveSessionList": {+ "type": "object",+ "properties": {+ "sessions": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ActiveSession"+ }+ }+ },+ "required": [+ "sessions"+ ]+ },+ "ActiveSession": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "Session id. Session tokens are never returned."+ },+ "browser": {+ "type": [+ "string",+ "null"+ ],+ "description": "Browser read from the session's user agent, if known."+ },+ "os": {+ "type": [+ "string",+ "null"+ ],+ "description": "Operating system or device read from the user agent."+ },+ "ipAddress": {+ "type": [+ "string",+ "null"+ ]+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "lastActiveAt": {+ "type": "string",+ "format": "date-time",+ "description": "When the session was last refreshed. Sessions refresh about once a day while in use."+ },+ "expiresAt": {+ "type": "string",+ "format": "date-time"+ },+ "current": {+ "type": "boolean",+ "description": "True for the session making this request."+ }+ },+ "required": [+ "id",+ "browser",+ "os",+ "ipAddress",+ "createdAt",+ "lastActiveAt",+ "expiresAt",+ "current"+ ]+ },+ "RevokedSessions": {+ "type": "object",+ "properties": {+ "revoked": {+ "type": "integer",+ "description": "Number of sessions that were signed out."+ }+ },+ "required": [+ "revoked"+ ]+ },"AdminUserList": {"type": "object","properties": {@@ -5720,6 +5802,82 @@"required": ["removed"]+ },+ "AdminApiKeyList": {+ "type": "object",+ "properties": {+ "apiKeys": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/AdminApiKey"+ }+ }+ },+ "required": [+ "apiKeys"+ ]+ },+ "AdminApiKey": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string"+ },+ "name": {+ "type": [+ "string",+ "null"+ ]+ },+ "start": {+ "type": [+ "string",+ "null"+ ],+ "description": "The first characters of the key, kept for recognizing it. The key itself and its hash are never returned."+ },+ "enabled": {+ "type": "boolean"+ },+ "createdAt": {+ "type": "string",+ "format": "date-time"+ },+ "lastUsedAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ },+ "expiresAt": {+ "type": [+ "string",+ "null"+ ],+ "format": "date-time"+ }+ },+ "required": [+ "id",+ "name",+ "start",+ "enabled",+ "createdAt",+ "lastUsedAt",+ "expiresAt"+ ]+ },+ "AdminRevokedApiKey": {+ "type": "object",+ "properties": {+ "revoked": {+ "type": "integer"+ }+ },+ "required": [+ "revoked"+ ]}},"parameters": {}@@ -24183,6 +24341,128 @@}}},+ "/user/sessions": {+ "get": {+ "operationId": "listOwnSessions",+ "tags": [+ "User"+ ],+ "summary": "List your active sessions",+ "description": "List the current user's signed-in sessions with device, IP address, and activity, marking the one making the request. Tokens are never returned. Requires a user session; API keys are rejected.",+ "responses": {+ "200": {+ "description": "Active sessions, current first",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ActiveSessionList"+ }+ }+ }+ },+ "401": {+ "description": "Unauthorized",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "Authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }+ },+ "/user/sessions/{sessionId}": {+ "delete": {+ "operationId": "revokeOwnSession",+ "tags": [+ "User"+ ],+ "summary": "Sign out one of your sessions",+ "description": "End another of the current user's sessions by id and close its realtime connections. To end every other session use better-auth's `POST /api/auth/revoke-other-sessions`; to end the current one, sign out.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "sessionId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Session signed out",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RevokedSessions"+ }+ }+ }+ },+ "401": {+ "description": "Unauthorized",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "Authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "No such session for this user",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "409": {+ "description": "The session is the one making the request",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }+ },"/admin/users": {"get": {"operationId": "listAdminUsers",@@ -25622,6 +25902,369 @@}}}+ },+ "/admin/users/{userId}/sessions": {+ "get": {+ "operationId": "listAdminUserSessions",+ "tags": [+ "Admin"+ ],+ "summary": "List a user's sessions",+ "description": "List a user's signed-in sessions with device, IP address, and activity. Tokens are never returned. `current` marks the administrator's own session. Requires an instance administrator session; API keys are rejected.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "userId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Active sessions",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ActiveSessionList"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "The caller is not an instance administrator or is authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "User not found",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ },+ "delete": {+ "operationId": "revokeAdminUserSessions",+ "tags": [+ "Admin"+ ],+ "summary": "Sign out all of a user's sessions",+ "description": "End every session of a user immediately, including realtime connections, and record it in the audit log. When administrators target themselves, their current session is kept. API keys keep working; revoke them separately.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "userId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Sessions signed out",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RevokedSessions"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "The caller is not an instance administrator or is authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "User not found",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }+ },+ "/admin/users/{userId}/sessions/{sessionId}": {+ "delete": {+ "operationId": "revokeAdminUserSession",+ "tags": [+ "Admin"+ ],+ "summary": "Sign out one of a user's sessions",+ "description": "End one session immediately, including its realtime connections, and record it in the audit log. The administrator's own current session can't be ended here; sign out instead.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "userId",+ "in": "path"+ },+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "sessionId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "Session signed out",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RevokedSessions"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "The caller is not an instance administrator or is authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "User or session not found",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "409": {+ "description": "The session is the administrator's current session",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }+ },+ "/admin/users/{userId}/api-keys": {+ "get": {+ "operationId": "listAdminUserApiKeys",+ "tags": [+ "Admin"+ ],+ "summary": "List a user's API keys",+ "description": "List a user's API keys with their name, start, status, and dates. The key and its hash are never returned. Requires an instance administrator session; API keys are rejected.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "userId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "API keys, newest first",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/AdminApiKeyList"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "The caller is not an instance administrator or is authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "User not found",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }+ },+ "/admin/users/{userId}/api-keys/{apiKeyId}": {+ "delete": {+ "operationId": "revokeAdminUserApiKey",+ "tags": [+ "Admin"+ ],+ "summary": "Revoke a user's API key",+ "description": "Delete a user's API key so it stops working immediately, and record it in the audit log.",+ "parameters": [+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "userId",+ "in": "path"+ },+ {+ "schema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 200+ },+ "required": true,+ "name": "apiKeyId",+ "in": "path"+ }+ ],+ "responses": {+ "200": {+ "description": "API key revoked",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/AdminRevokedApiKey"+ }+ }+ }+ },+ "401": {+ "description": "Missing or invalid credentials",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "403": {+ "description": "The caller is not an instance administrator or is authenticated with an API key",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "404": {+ "description": "User or API key not found",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ApiError"+ }+ }+ }+ },+ "429": {+ "$ref": "#/components/responses/ApiKeyRateLimited"+ }+ }+ }}},"webhooks": {}diff --git a/apps/web/src/components/account/sessions/active-sessions-settings.tsx b/apps/web/src/components/account/sessions/active-sessions-settings.tsxnew file mode 100644index 000000000..09990cf12--- /dev/null+++ b/apps/web/src/components/account/sessions/active-sessions-settings.tsx@@ -0,0 +1,110 @@+import { LogOutIcon } from "lucide-react";+import { useState } from "react";+import { useTranslation } from "react-i18next";+import { ConfirmDialog } from "@/components/settings/confirm-dialog";+import { SettingsCard } from "@/components/settings/settings-card";+import { SettingsRowsSkeleton } from "@/components/settings/settings-rows-skeleton";+import { SettingsSection } from "@/components/settings/settings-section";+import { Button } from "@/components/ui/button";+import type { ActiveSession } from "@/fetchers/user/session-types";+import useRevokeOtherSessions from "@/hooks/mutations/user/use-revoke-other-sessions";+import useRevokeUserSession from "@/hooks/mutations/user/use-revoke-user-session";+import useUserSessions from "@/hooks/queries/user/use-user-sessions";+import { toast } from "@/lib/toast";+import { RevokeSessionDialog } from "./revoke-session-dialog";+import { SessionRow } from "./session-row";++export function ActiveSessionsSettings() {+ const { t } = useTranslation();+ const { data, isPending, isError } = useUserSessions();+ const revokeSession = useRevokeUserSession();+ const revokeOthers = useRevokeOtherSessions();+ const [revoking, setRevoking] = useState<ActiveSession | null>(null);+ const [confirmOthers, setConfirmOthers] = useState(false);+ const sessions = data?.sessions ?? [];+ const hasOthers = sessions.some((session) => !session.current);++ const handleRevoke = async () => {+ if (!revoking) return;+ try {+ await revokeSession.mutateAsync(revoking.id);+ toast.success(t("settings:sessions.toastRevoked"), { icon: LogOutIcon });+ setRevoking(null);+ } catch {+ toast.error(t("settings:sessions.toastRevokeError"));+ }+ };++ const handleRevokeOthers = async () => {+ try {+ await revokeOthers.mutateAsync();+ toast.success(t("settings:securityPage.sessions.toastRevokedOthers"), {+ icon: LogOutIcon,+ });+ setConfirmOthers(false);+ } catch {+ toast.error(t("settings:sessions.toastRevokeError"));+ }+ };++ return (+ <SettingsSection+ title={t("settings:securityPage.sessions.title")}+ description={t("settings:securityPage.sessions.description")}+ action={+ hasOthers ? (+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => setConfirmOthers(true)}+ >+ {t("settings:securityPage.sessions.revokeOthers")}+ </Button>+ ) : null+ }+ >+ <SettingsCard>+ {isPending ? (+ <SettingsRowsSkeleton rows={2} withDescription />+ ) : isError ? (+ <p+ role="alert"+ className="px-4 py-3.5 text-destructive-foreground text-sm"+ >+ {t("settings:sessions.loadError")}+ </p>+ ) : (+ sessions.map((session) => (+ <SessionRow+ key={session.id}+ session={session}+ onRevoke={() => setRevoking(session)}+ />+ ))+ )}+ </SettingsCard>++ <RevokeSessionDialog+ session={revoking}+ pending={revokeSession.isPending}+ onConfirm={handleRevoke}+ onClose={() => setRevoking(null)}+ />+ <ConfirmDialog+ open={confirmOthers}+ onOpenChange={(open) => {+ if (open || !revokeOthers.isPending) setConfirmOthers(open);+ }}+ title={t("settings:securityPage.sessions.revokeOthersConfirmTitle")}+ description={t(+ "settings:securityPage.sessions.revokeOthersConfirmDescription",+ )}+ confirmLabel={t("settings:securityPage.sessions.revokeOthers")}+ pendingLabel={t("settings:sessions.revoking")}+ pending={revokeOthers.isPending}+ onConfirm={handleRevokeOthers}+ />+ </SettingsSection>+ );+}diff --git a/apps/web/src/components/account/sessions/get-session-device-label.test.ts b/apps/web/src/components/account/sessions/get-session-device-label.test.tsnew file mode 100644index 000000000..f17ec64c3--- /dev/null+++ b/apps/web/src/components/account/sessions/get-session-device-label.test.ts@@ -0,0 +1,28 @@+import { describe, expect, it } from "vite-plus/test";+import { getSessionDeviceLabel } from "./get-session-device-label";++const t = (key: string, values?: Record<string, unknown>) =>+ values ? `${key}:${JSON.stringify(values)}` : key;++describe("getSessionDeviceLabel", () => {+ it("names browser and system together", () => {+ expect(getSessionDeviceLabel({ browser: "Firefox", os: "Linux" }, t)).toBe(+ 'settings:sessions.device:{"browser":"Firefox","os":"Linux"}',+ );+ });++ it("falls back to whichever half is known", () => {+ expect(getSessionDeviceLabel({ browser: null, os: "iPhone" }, t)).toBe(+ "iPhone",+ );+ expect(getSessionDeviceLabel({ browser: "Safari", os: null }, t)).toBe(+ "Safari",+ );+ });++ it("says when the device is unknown", () => {+ expect(getSessionDeviceLabel({ browser: null, os: null }, t)).toBe(+ "settings:sessions.unknownDevice",+ );+ });+});diff --git a/apps/web/src/components/account/sessions/get-session-device-label.ts b/apps/web/src/components/account/sessions/get-session-device-label.tsnew file mode 100644index 000000000..22dd7520a--- /dev/null+++ b/apps/web/src/components/account/sessions/get-session-device-label.ts@@ -0,0 +1,9 @@+type Translate = (key: string, values?: Record<string, unknown>) => string;++type Device = { browser: string | null; os: string | null };++/** "Firefox on Linux", or whichever half is known. */+export function getSessionDeviceLabel({ browser, os }: Device, t: Translate) {+ if (browser && os) return t("settings:sessions.device", { browser, os });+ return browser ?? os ?? t("settings:sessions.unknownDevice");+}diff --git a/apps/web/src/components/account/sessions/revoke-session-dialog.tsx b/apps/web/src/components/account/sessions/revoke-session-dialog.tsxnew file mode 100644index 000000000..f7027b41e--- /dev/null+++ b/apps/web/src/components/account/sessions/revoke-session-dialog.tsx@@ -0,0 +1,36 @@+import { useTranslation } from "react-i18next";+import { ConfirmDialog } from "@/components/settings/confirm-dialog";+import type { ActiveSession } from "@/fetchers/user/session-types";+import { getSessionDeviceLabel } from "./get-session-device-label";++type RevokeSessionDialogProps = {+ session: ActiveSession | null;+ pending: boolean;+ onConfirm: () => void;+ onClose: () => void;+};++export function RevokeSessionDialog({+ session,+ pending,+ onConfirm,+ onClose,+}: RevokeSessionDialogProps) {+ const { t } = useTranslation();+ const device = session ? getSessionDeviceLabel(session, t) : "";++ return (+ <ConfirmDialog+ open={session !== null}+ onOpenChange={(open) => {+ if (!open && !pending) onClose();+ }}+ title={t("settings:sessions.revokeConfirmTitle", { device })}+ description={t("settings:sessions.revokeConfirmDescription")}+ confirmLabel={t("settings:sessions.revoke")}+ pendingLabel={t("settings:sessions.revoking")}+ pending={pending}+ onConfirm={onConfirm}+ />+ );+}diff --git a/apps/web/src/components/account/sessions/session-row.tsx b/apps/web/src/components/account/sessions/session-row.tsxnew file mode 100644index 000000000..7dbf7855f--- /dev/null+++ b/apps/web/src/components/account/sessions/session-row.tsx@@ -0,0 +1,62 @@+import { LogOutIcon, MonitorIcon, SmartphoneIcon } from "lucide-react";+import { useTranslation } from "react-i18next";+import { SettingsRow } from "@/components/settings/settings-row";+import { StatusBadge } from "@/components/settings/status-badge";+import { Button } from "@/components/ui/button";+import type { ActiveSession } from "@/fetchers/user/session-types";+import { formatDateMedium, formatRelativeTime } from "@/lib/format";+import { getSessionDeviceLabel } from "./get-session-device-label";++const MOBILE_SYSTEMS = new Set(["iPhone", "iPad", "Android"]);++type SessionRowProps = {+ session: ActiveSession;+ /** Hidden for the current session: that one ends by signing out. */+ onRevoke?: () => void;+ disabled?: boolean;+};++export function SessionRow({ session, onRevoke, disabled }: SessionRowProps) {+ const { t } = useTranslation();+ const device = getSessionDeviceLabel(session, t);+ const Icon =+ session.os && MOBILE_SYSTEMS.has(session.os) ? SmartphoneIcon : MonitorIcon;+ const details = [+ session.ipAddress,+ t("settings:sessions.lastActive", {+ time: formatRelativeTime(session.lastActiveAt),+ }),+ t("settings:sessions.signedIn", {+ date: formatDateMedium(session.createdAt),+ }),+ ].filter(Boolean);++ return (+ <SettingsRow+ icon={<Icon />}+ title={device}+ badge={+ session.current ? (+ <StatusBadge tone="success">+ {t("settings:sessions.thisDevice")}+ </StatusBadge>+ ) : null+ }+ description={<span className="tabular-nums">{details.join(" / ")}</span>}+ >+ {onRevoke && !session.current ? (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ disabled={disabled}+ aria-label={t("settings:sessions.revokeLabel", { device })}+ onClick={onRevoke}+ >+ <LogOutIcon aria-hidden="true" />+ {t("settings:sessions.revoke")}+ </Button>+ ) : null}+ </SettingsRow>+ );+}diff --git a/apps/web/src/components/admin/audit-log/audit-log-categories.ts b/apps/web/src/components/admin/audit-log/audit-log-categories.tsindex 818bb2e22..5138412bd 100644--- a/apps/web/src/components/admin/audit-log/audit-log-categories.ts+++ b/apps/web/src/components/admin/audit-log/audit-log-categories.ts@@ -3,6 +3,7 @@ export const AUDIT_LOG_CATEGORIES = [{ value: "", labelKey: "settings:adminAuditLog.categories.all" },{ value: "user", labelKey: "settings:adminAuditLog.categories.user" },{ value: "session", labelKey: "settings:adminAuditLog.categories.session" },+ { value: "api_key", labelKey: "settings:adminAuditLog.categories.apiKey" },{value: "workspace",labelKey: "settings:adminAuditLog.categories.workspace",diff --git a/apps/web/src/components/admin/audit-log/get-audit-action-label.ts b/apps/web/src/components/admin/audit-log/get-audit-action-label.tsindex e4b121f0a..c3ebbf9cb 100644--- a/apps/web/src/components/admin/audit-log/get-audit-action-label.ts+++ b/apps/web/src/components/admin/audit-log/get-audit-action-label.ts@@ -20,6 +20,7 @@ const ACTION_LABEL_KEYS = new Map([["user.avatar_removed", "settings:adminAuditLog.actions.userAvatarRemoved"],["session.revoked", "settings:adminAuditLog.actions.sessionRevoked"],["session.revoked_all", "settings:adminAuditLog.actions.sessionRevokedAll"],+ ["api_key.revoked", "settings:adminAuditLog.actions.apiKeyRevoked"],["workspace.member_added","settings:adminAuditLog.actions.workspaceMemberAdded",diff --git a/apps/web/src/components/admin/audit-log/get-audit-entry-detail.test.ts b/apps/web/src/components/admin/audit-log/get-audit-entry-detail.test.tsindex ad5102a71..bc68c1244 100644--- a/apps/web/src/components/admin/audit-log/get-audit-entry-detail.test.ts+++ b/apps/web/src/components/admin/audit-log/get-audit-entry-detail.test.ts@@ -70,4 +70,22 @@ describe("getAuditEntryDetail", () => {getAuditEntryDetail({ action: "role.created", metadata: { a: 1 } }, t),).toBeNull();});++ it("counts revoked sessions and names revoked API keys", () => {+ expect(+ getAuditEntryDetail(+ { action: "session.revoked_all", metadata: { count: 3 } },+ t,+ ),+ ).toBe('settings:adminAuditLog.details.sessionCount {"count":3}');+ expect(+ getAuditEntryDetail(+ {+ action: "api_key.revoked",+ metadata: { keyId: "k1", keyName: "CI deploys" },+ },+ t,+ ),+ ).toBe("CI deploys");+ });});diff --git a/apps/web/src/components/admin/audit-log/get-audit-entry-detail.ts b/apps/web/src/components/admin/audit-log/get-audit-entry-detail.tsindex 1f70bc767..6b249e441 100644--- a/apps/web/src/components/admin/audit-log/get-audit-entry-detail.ts+++ b/apps/web/src/components/admin/audit-log/get-audit-entry-detail.ts@@ -82,6 +82,14 @@ export function getAuditEntryDetail(}case "user.deleted":return text(metadata.name);+ case "session.revoked_all":+ return typeof metadata.count === "number"+ ? t("settings:adminAuditLog.details.sessionCount", {+ count: metadata.count,+ })+ : null;+ case "api_key.revoked":+ return text(metadata.keyName);case "workspace.member_added":return t("settings:adminAuditLog.details.memberWithRole", {member: memberName(metadata),diff --git a/apps/web/src/components/admin/user-management/user-directory-row.tsx b/apps/web/src/components/admin/user-management/user-directory-row.tsxindex b40953197..495b21c57 100644--- a/apps/web/src/components/admin/user-management/user-directory-row.tsx+++ b/apps/web/src/components/admin/user-management/user-directory-row.tsx@@ -5,6 +5,7 @@ import {KeyRoundIcon,type LucideIcon,MailIcon,+ MonitorSmartphoneIcon,PencilIcon,Trash2Icon,} from "lucide-react";@@ -44,6 +45,7 @@ type UserDirectoryRowProps = {canSendPasswordReset: boolean;onEdit: () => void;onAction: (type: UserActionType) => void;+ onOpenSecurity: () => void;};const CELL_CLASS = "hidden shrink-0 sm:flex";@@ -53,6 +55,7 @@ export function UserDirectoryRow({isSelf,canSendPasswordReset,onEdit,+ onOpenSecurity,onAction,}: UserDirectoryRowProps) {const { t } = useTranslation();@@ -66,6 +69,12 @@ export function UserDirectoryRow({icon: PencilIcon,onSelect: onEdit,},+ {+ id: "security",+ label: t("settings:adminUsers.actions.security"),+ icon: MonitorSmartphoneIcon,+ onSelect: onOpenSecurity,+ },...getUserActionTypes(user, { isSelf, canSendPasswordReset }).map((type) => ({id: type,diff --git a/apps/web/src/components/admin/user-management/user-management-panel.tsx b/apps/web/src/components/admin/user-management/user-management-panel.tsxindex 7d7d7039c..89d73099a 100644--- a/apps/web/src/components/admin/user-management/user-management-panel.tsx+++ b/apps/web/src/components/admin/user-management/user-management-panel.tsx@@ -8,6 +8,7 @@ import { DirectorySearchInput } from "@/components/admin/directory/directory-seaimport { DirectorySkeletonRows } from "@/components/admin/directory/directory-skeleton-rows";import { getPageCount } from "@/components/admin/directory/get-page-count";import { useDirectoryPaging } from "@/components/admin/directory/use-directory-paging";+import { UserSecurityDialog } from "@/components/admin/user-security/user-security-dialog";import useAuth from "@/components/providers/auth-provider/hooks/use-auth";import { SettingsCard } from "@/components/settings/settings-card";import { SettingsEmpty } from "@/components/settings/settings-empty";@@ -43,6 +44,8 @@ function UserManagementPanel() {const [filters, setFilters] = useState<UserFilterValues>(NO_USER_FILTERS);const [isCreating, setIsCreating] = useState(false);const [editingUser, setEditingUser] = useState<AdminUser | null>(null);+ const [securityUser, setSecurityUser] = useState<AdminUser | null>(null);+ const [isSecurityOpen, setIsSecurityOpen] = useState(false);const [pendingAction, setPendingAction] = useState<PendingUserAction | null>(null,);@@ -154,6 +157,10 @@ function UserManagementPanel() {isSelf={user.id === currentUser?.id}canSendPasswordReset={config?.disableLoginForm !== true}onEdit={() => setEditingUser(user)}+ onOpenSecurity={() => {+ setSecurityUser(user);+ setIsSecurityOpen(true);+ }}onAction={(type) => setPendingAction({ type, user })}/>))@@ -185,6 +192,13 @@ function UserManagementPanel() {onClose={() => setEditingUser(null)}/>+ <UserSecurityDialog+ user={securityUser}+ isSelf={securityUser?.id === currentUser?.id}+ open={isSecurityOpen}+ onOpenChange={setIsSecurityOpen}+ />+<UserConfirmDialogaction={pendingAction}onClose={() => setPendingAction(null)}diff --git a/apps/web/src/components/admin/user-security/admin-api-key-row.tsx b/apps/web/src/components/admin/user-security/admin-api-key-row.tsxnew file mode 100644index 000000000..330d22536--- /dev/null+++ b/apps/web/src/components/admin/user-security/admin-api-key-row.tsx@@ -0,0 +1,75 @@+import { KeyRoundIcon } from "lucide-react";+import { useTranslation } from "react-i18next";+import { getApiKeyExpiry } from "@/components/settings/api-keys/get-api-key-expiry";+import { SettingsRow } from "@/components/settings/settings-row";+import { StatusBadge } from "@/components/settings/status-badge";+import { Button } from "@/components/ui/button";+import type { AdminApiKey } from "@/fetchers/admin/get-admin-user-api-keys";+import { formatDateMedium, formatRelativeTime } from "@/lib/format";++type Props = {+ apiKey: AdminApiKey;+ onRevoke: () => void;+};++export function AdminApiKeyRow({ apiKey, onRevoke }: Props) {+ const { t } = useTranslation();+ const name = apiKey.name || t("settings:developerPage.unnamedKey");+ const expiry = getApiKeyExpiry(apiKey.expiresAt);+ const inactive = expiry.status === "expired" || !apiKey.enabled;+ const details = [+ t("settings:apiKey.row.created", {+ date: formatDateMedium(apiKey.createdAt),+ }),+ apiKey.lastUsedAt+ ? t("settings:adminUsers.security.lastUsed", {+ time: formatRelativeTime(apiKey.lastUsedAt),+ })+ : t("settings:adminUsers.security.neverUsed"),+ expiry.status === "never"+ ? t("settings:apiKey.row.neverExpires")+ : t(+ expiry.status === "expired"+ ? "settings:apiKey.row.expired"+ : "settings:apiKey.row.expires",+ { date: formatDateMedium(expiry.date) },+ ),+ ];++ return (+ <SettingsRow+ icon={<KeyRoundIcon className={inactive ? "opacity-50" : undefined} />}+ title={name}+ titleClassName={inactive ? "text-muted-foreground" : undefined}+ badge={+ !apiKey.enabled ? (+ <StatusBadge tone="neutral">+ {t("settings:adminUsers.security.disabled")}+ </StatusBadge>+ ) : expiry.status === "expired" ? (+ <StatusBadge tone="destructive">+ {t("settings:apiKey.row.expiredBadge")}+ </StatusBadge>+ ) : null+ }+ description={+ <span className="flex min-w-0 items-center gap-2">+ {apiKey.start ? (+ <span className="shrink-0 font-mono">{apiKey.start}…</span>+ ) : null}+ <span className="truncate">{details.join(" / ")}</span>+ </span>+ }+ >+ <Button+ type="button"+ variant="ghost"+ size="sm"+ aria-label={t("settings:adminUsers.security.revokeKeyLabel", { name })}+ onClick={onRevoke}+ >+ {t("settings:adminUsers.security.revokeKey")}+ </Button>+ </SettingsRow>+ );+}diff --git a/apps/web/src/components/admin/user-security/user-api-keys-section.tsx b/apps/web/src/components/admin/user-security/user-api-keys-section.tsxnew file mode 100644index 000000000..c51fd25e8--- /dev/null+++ b/apps/web/src/components/admin/user-security/user-api-keys-section.tsx@@ -0,0 +1,96 @@+import { Trash2Icon } from "lucide-react";+import { useState } from "react";+import { useTranslation } from "react-i18next";+import { ConfirmDialog } from "@/components/settings/confirm-dialog";+import { SettingsCard } from "@/components/settings/settings-card";+import { SettingsRowsSkeleton } from "@/components/settings/settings-rows-skeleton";+import { SettingsSection } from "@/components/settings/settings-section";+import { Button } from "@/components/ui/button";+import type { AdminApiKey } from "@/fetchers/admin/get-admin-user-api-keys";+import type { AdminUser } from "@/fetchers/admin/types";+import useRevokeAdminUserApiKey from "@/hooks/mutations/admin/use-revoke-admin-user-api-key";+import useAdminUserApiKeys from "@/hooks/queries/admin/use-admin-user-api-keys";+import { toast } from "@/lib/toast";+import { AdminApiKeyRow } from "./admin-api-key-row";++export function UserApiKeysSection({ user }: { user: AdminUser }) {+ const { t } = useTranslation();+ const { data, isPending, isError, refetch } = useAdminUserApiKeys(user.id);+ const revokeKey = useRevokeAdminUserApiKey();+ const [revoking, setRevoking] = useState<AdminApiKey | null>(null);+ const apiKeys = data?.apiKeys ?? [];+ const revokingName = revoking?.name || t("settings:developerPage.unnamedKey");++ const handleRevoke = async () => {+ if (!revoking) return;+ try {+ await revokeKey.mutateAsync({ userId: user.id, apiKeyId: revoking.id });+ toast.success(t("settings:adminUsers.security.toastKeyRevoked"), {+ icon: Trash2Icon,+ });+ setRevoking(null);+ } catch {+ toast.error(t("settings:adminUsers.security.toastKeyRevokeError"));+ }+ };++ const renderKeys = () => {+ if (isPending) return <SettingsRowsSkeleton rows={1} withDescription />;+ if (isError) {+ return (+ <div className="flex items-center justify-between gap-3 px-4 py-3.5">+ <p role="alert" className="text-destructive-foreground text-sm">+ {t("settings:adminUsers.security.apiKeysLoadError")}+ </p>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => refetch()}+ >+ {t("settings:adminUsers.retry")}+ </Button>+ </div>+ );+ }+ if (apiKeys.length === 0) {+ return (+ <p className="px-4 py-3.5 text-muted-foreground text-sm">+ {t("settings:adminUsers.security.apiKeysEmpty")}+ </p>+ );+ }+ return apiKeys.map((apiKey) => (+ <AdminApiKeyRow+ key={apiKey.id}+ apiKey={apiKey}+ onRevoke={() => setRevoking(apiKey)}+ />+ ));+ };++ return (+ <SettingsSection+ title={t("settings:adminUsers.security.apiKeysTitle")}+ description={t("settings:adminUsers.security.apiKeysDescription")}+ >+ <SettingsCard>{renderKeys()}</SettingsCard>+ <ConfirmDialog+ open={revoking !== null}+ onOpenChange={(open) => {+ if (!open && !revokeKey.isPending) setRevoking(null);+ }}+ title={t("settings:adminUsers.security.revokeKeyConfirmTitle", {+ name: revokingName,+ })}+ description={t(+ "settings:adminUsers.security.revokeKeyConfirmDescription",+ )}+ confirmLabel={t("settings:adminUsers.security.revokeKey")}+ pendingLabel={t("settings:adminUsers.security.revokingKey")}+ pending={revokeKey.isPending}+ onConfirm={handleRevoke}+ />+ </SettingsSection>+ );+}diff --git a/apps/web/src/components/admin/user-security/user-security-dialog.tsx b/apps/web/src/components/admin/user-security/user-security-dialog.tsxnew file mode 100644index 000000000..028eab2e2--- /dev/null+++ b/apps/web/src/components/admin/user-security/user-security-dialog.tsx@@ -0,0 +1,52 @@+import { useTranslation } from "react-i18next";+import {+ Dialog,+ DialogDescription,+ DialogHeader,+ DialogPanel,+ DialogPopup,+ DialogTitle,+} from "@/components/ui/dialog";+import type { AdminUser } from "@/fetchers/admin/types";+import { UserApiKeysSection } from "./user-api-keys-section";+import { UserSessionsSection } from "./user-sessions-section";++type Props = {+ user: AdminUser | null;+ isSelf: boolean;+ open: boolean;+ onOpenChange: (open: boolean) => void;+};++/** An admin's view of one user's sessions and API keys. */+export function UserSecurityDialog({+ user,+ isSelf,+ open,+ onOpenChange,+}: Props) {+ const { t } = useTranslation();++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogPopup className="sm:max-w-2xl">+ <DialogHeader>+ <DialogTitle>+ {t("settings:adminUsers.security.title", { name: user?.name })}+ </DialogTitle>+ <DialogDescription>+ {t("settings:adminUsers.security.description")}+ </DialogDescription>+ </DialogHeader>+ <DialogPanel>+ {user && open ? (+ <div className="flex flex-col gap-8">+ <UserSessionsSection user={user} isSelf={isSelf} />+ <UserApiKeysSection user={user} />+ </div>+ ) : null}+ </DialogPanel>+ </DialogPopup>+ </Dialog>+ );+}diff --git a/apps/web/src/components/admin/user-security/user-sessions-section.tsx b/apps/web/src/components/admin/user-security/user-sessions-section.tsxnew file mode 100644index 000000000..a4a781ecf--- /dev/null+++ b/apps/web/src/components/admin/user-security/user-sessions-section.tsx@@ -0,0 +1,135 @@+import { LogOutIcon } from "lucide-react";+import { useState } from "react";+import { useTranslation } from "react-i18next";+import { RevokeSessionDialog } from "@/components/account/sessions/revoke-session-dialog";+import { SessionRow } from "@/components/account/sessions/session-row";+import { ConfirmDialog } from "@/components/settings/confirm-dialog";+import { SettingsCard } from "@/components/settings/settings-card";+import { SettingsRowsSkeleton } from "@/components/settings/settings-rows-skeleton";+import { SettingsSection } from "@/components/settings/settings-section";+import { Button } from "@/components/ui/button";+import type { AdminUser } from "@/fetchers/admin/types";+import type { ActiveSession } from "@/fetchers/user/session-types";+import useRevokeAdminUserSession from "@/hooks/mutations/admin/use-revoke-admin-user-session";+import useRevokeAdminUserSessions from "@/hooks/mutations/admin/use-revoke-admin-user-sessions";+import useAdminUserSessions from "@/hooks/queries/admin/use-admin-user-sessions";+import { toast } from "@/lib/toast";++type Props = {+ user: AdminUser;+ isSelf: boolean;+};++export function UserSessionsSection({ user, isSelf }: Props) {+ const { t } = useTranslation();+ const { data, isPending, isError, refetch } = useAdminUserSessions(user.id);+ const revokeOne = useRevokeAdminUserSession();+ const revokeAll = useRevokeAdminUserSessions();+ const [revoking, setRevoking] = useState<ActiveSession | null>(null);+ const [confirmAll, setConfirmAll] = useState(false);+ const sessions = data?.sessions ?? [];+ const canRevokeAll = sessions.some((session) => !session.current);++ const handleRevoke = async () => {+ if (!revoking) return;+ try {+ await revokeOne.mutateAsync({ userId: user.id, sessionId: revoking.id });+ toast.success(t("settings:sessions.toastRevoked"), { icon: LogOutIcon });+ setRevoking(null);+ } catch {+ toast.error(t("settings:sessions.toastRevokeError"));+ }+ };++ const handleRevokeAll = async () => {+ try {+ await revokeAll.mutateAsync(user.id);+ toast.success(t("settings:adminUsers.security.toastRevokedAll"), {+ icon: LogOutIcon,+ });+ setConfirmAll(false);+ } catch {+ toast.error(t("settings:sessions.toastRevokeError"));+ }+ };++ const renderSessions = () => {+ if (isPending) return <SettingsRowsSkeleton rows={2} withDescription />;+ if (isError) {+ return (+ <div className="flex items-center justify-between gap-3 px-4 py-3.5">+ <p role="alert" className="text-destructive-foreground text-sm">+ {t("settings:sessions.loadError")}+ </p>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => refetch()}+ >+ {t("settings:adminUsers.retry")}+ </Button>+ </div>+ );+ }+ if (sessions.length === 0) {+ return (+ <p className="px-4 py-3.5 text-muted-foreground text-sm">+ {t("settings:adminUsers.security.sessionsEmpty")}+ </p>+ );+ }+ return sessions.map((session) => (+ <SessionRow+ key={session.id}+ session={session}+ onRevoke={() => setRevoking(session)}+ />+ ));+ };++ return (+ <SettingsSection+ title={t("settings:adminUsers.security.sessionsTitle")}+ action={+ canRevokeAll ? (+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => setConfirmAll(true)}+ >+ {t("settings:adminUsers.security.revokeAll")}+ </Button>+ ) : null+ }+ >+ <SettingsCard>{renderSessions()}</SettingsCard>++ <RevokeSessionDialog+ session={revoking}+ pending={revokeOne.isPending}+ onConfirm={handleRevoke}+ onClose={() => setRevoking(null)}+ />+ <ConfirmDialog+ open={confirmAll}+ onOpenChange={(open) => {+ if (open || !revokeAll.isPending) setConfirmAll(open);+ }}+ title={t("settings:adminUsers.security.revokeAllConfirmTitle", {+ name: user.name,+ })}+ description={t(+ isSelf+ ? "settings:adminUsers.security.revokeAllSelfDescription"+ : "settings:adminUsers.security.revokeAllConfirmDescription",+ )}+ confirmLabel={t("settings:adminUsers.security.revokeAll")}+ pendingLabel={t("settings:sessions.revoking")}+ pending={revokeAll.isPending}+ onConfirm={handleRevokeAll}+ />+ </SettingsSection>+ );+}diff --git a/apps/web/src/fetchers/admin/get-admin-user-api-keys.ts b/apps/web/src/fetchers/admin/get-admin-user-api-keys.tsnew file mode 100644index 000000000..0468f1f01--- /dev/null+++ b/apps/web/src/fetchers/admin/get-admin-user-api-keys.ts@@ -0,0 +1,18 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function getAdminUserApiKeys(userId: string) {+ const response = await client.admin.users[":userId"]["api-keys"].$get({+ param: { userId },+ });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}++export type AdminApiKey = Awaited<+ ReturnType<typeof getAdminUserApiKeys>+>["apiKeys"][number];diff --git a/apps/web/src/fetchers/admin/get-admin-user-sessions.ts b/apps/web/src/fetchers/admin/get-admin-user-sessions.tsnew file mode 100644index 000000000..4a669ef18--- /dev/null+++ b/apps/web/src/fetchers/admin/get-admin-user-sessions.ts@@ -0,0 +1,14 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function getAdminUserSessions(userId: string) {+ const response = await client.admin.users[":userId"].sessions.$get({+ param: { userId },+ });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/admin/revoke-admin-user-api-key.ts b/apps/web/src/fetchers/admin/revoke-admin-user-api-key.tsnew file mode 100644index 000000000..bcd34afbf--- /dev/null+++ b/apps/web/src/fetchers/admin/revoke-admin-user-api-key.ts@@ -0,0 +1,20 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function revokeAdminUserApiKey({+ userId,+ apiKeyId,+}: {+ userId: string;+ apiKeyId: string;+}) {+ const response = await client.admin.users[":userId"]["api-keys"][+ ":apiKeyId"+ ].$delete({ param: { userId, apiKeyId } });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/admin/revoke-admin-user-session.ts b/apps/web/src/fetchers/admin/revoke-admin-user-session.tsnew file mode 100644index 000000000..b8c2d9780--- /dev/null+++ b/apps/web/src/fetchers/admin/revoke-admin-user-session.ts@@ -0,0 +1,20 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function revokeAdminUserSession({+ userId,+ sessionId,+}: {+ userId: string;+ sessionId: string;+}) {+ const response = await client.admin.users[":userId"].sessions[+ ":sessionId"+ ].$delete({ param: { userId, sessionId } });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/admin/revoke-admin-user-sessions.ts b/apps/web/src/fetchers/admin/revoke-admin-user-sessions.tsnew file mode 100644index 000000000..6be2d8642--- /dev/null+++ b/apps/web/src/fetchers/admin/revoke-admin-user-sessions.ts@@ -0,0 +1,14 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function revokeAdminUserSessions(userId: string) {+ const response = await client.admin.users[":userId"].sessions.$delete({+ param: { userId },+ });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/user/get-user-sessions.ts b/apps/web/src/fetchers/user/get-user-sessions.tsnew file mode 100644index 000000000..f08886864--- /dev/null+++ b/apps/web/src/fetchers/user/get-user-sessions.ts@@ -0,0 +1,12 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function getUserSessions() {+ const response = await client.user.sessions.$get();++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/user/revoke-user-session.ts b/apps/web/src/fetchers/user/revoke-user-session.tsnew file mode 100644index 000000000..2406e0967--- /dev/null+++ b/apps/web/src/fetchers/user/revoke-user-session.ts@@ -0,0 +1,14 @@+import { client } from "@kaneo/libs";+import { HttpError } from "@/lib/http-error";++export async function revokeUserSession(sessionId: string) {+ const response = await client.user.sessions[":sessionId"].$delete({+ param: { sessionId },+ });++ if (!response.ok) {+ throw await HttpError.fromResponse(response);+ }++ return response.json();+}diff --git a/apps/web/src/fetchers/user/session-types.ts b/apps/web/src/fetchers/user/session-types.tsnew file mode 100644index 000000000..90ad266ab--- /dev/null+++ b/apps/web/src/fetchers/user/session-types.ts@@ -0,0 +1,5 @@+import type { getUserSessions } from "./get-user-sessions";++export type ActiveSession = Awaited<+ ReturnType<typeof getUserSessions>+>["sessions"][number];diff --git a/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-api-key.ts b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-api-key.tsnew file mode 100644index 000000000..69506f6a3--- /dev/null+++ b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-api-key.ts@@ -0,0 +1,17 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { revokeAdminUserApiKey } from "@/fetchers/admin/revoke-admin-user-api-key";+import { adminUserApiKeysQueryKey } from "@/hooks/queries/admin/use-admin-user-api-keys";++function useRevokeAdminUserApiKey() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: revokeAdminUserApiKey,+ onSettled: (_data, _error, { userId }) =>+ queryClient.invalidateQueries({+ queryKey: adminUserApiKeysQueryKey(userId),+ }),+ });+}++export default useRevokeAdminUserApiKey;diff --git a/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-session.ts b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-session.tsnew file mode 100644index 000000000..eed87ab01--- /dev/null+++ b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-session.ts@@ -0,0 +1,17 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { revokeAdminUserSession } from "@/fetchers/admin/revoke-admin-user-session";+import { adminUserSessionsQueryKey } from "@/hooks/queries/admin/use-admin-user-sessions";++function useRevokeAdminUserSession() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: revokeAdminUserSession,+ onSettled: (_data, _error, { userId }) =>+ queryClient.invalidateQueries({+ queryKey: adminUserSessionsQueryKey(userId),+ }),+ });+}++export default useRevokeAdminUserSession;diff --git a/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-sessions.ts b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-sessions.tsnew file mode 100644index 000000000..d36207e93--- /dev/null+++ b/apps/web/src/hooks/mutations/admin/use-revoke-admin-user-sessions.ts@@ -0,0 +1,17 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { revokeAdminUserSessions } from "@/fetchers/admin/revoke-admin-user-sessions";+import { adminUserSessionsQueryKey } from "@/hooks/queries/admin/use-admin-user-sessions";++function useRevokeAdminUserSessions() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: revokeAdminUserSessions,+ onSettled: (_data, _error, userId) =>+ queryClient.invalidateQueries({+ queryKey: adminUserSessionsQueryKey(userId),+ }),+ });+}++export default useRevokeAdminUserSessions;diff --git a/apps/web/src/hooks/mutations/user/use-revoke-other-sessions.ts b/apps/web/src/hooks/mutations/user/use-revoke-other-sessions.tsnew file mode 100644index 000000000..f8b9e9045--- /dev/null+++ b/apps/web/src/hooks/mutations/user/use-revoke-other-sessions.ts@@ -0,0 +1,19 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { USER_SESSIONS_QUERY_KEY } from "@/hooks/queries/user/use-user-sessions";+import { authClient } from "@/lib/auth-client";++function useRevokeOtherSessions() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async () => {+ const { data, error } = await authClient.revokeOtherSessions();+ if (error) throw new Error(error.message ?? "");+ return data;+ },+ onSettled: () =>+ queryClient.invalidateQueries({ queryKey: USER_SESSIONS_QUERY_KEY }),+ });+}++export default useRevokeOtherSessions;diff --git a/apps/web/src/hooks/mutations/user/use-revoke-user-session.ts b/apps/web/src/hooks/mutations/user/use-revoke-user-session.tsnew file mode 100644index 000000000..11cfdea3d--- /dev/null+++ b/apps/web/src/hooks/mutations/user/use-revoke-user-session.ts@@ -0,0 +1,15 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import { revokeUserSession } from "@/fetchers/user/revoke-user-session";+import { USER_SESSIONS_QUERY_KEY } from "@/hooks/queries/user/use-user-sessions";++function useRevokeUserSession() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: revokeUserSession,+ onSettled: () =>+ queryClient.invalidateQueries({ queryKey: USER_SESSIONS_QUERY_KEY }),+ });+}++export default useRevokeUserSession;diff --git a/apps/web/src/hooks/queries/admin/use-admin-user-api-keys.ts b/apps/web/src/hooks/queries/admin/use-admin-user-api-keys.tsnew file mode 100644index 000000000..18c1c3a2a--- /dev/null+++ b/apps/web/src/hooks/queries/admin/use-admin-user-api-keys.ts@@ -0,0 +1,16 @@+import { useQuery } from "@tanstack/react-query";+import { getAdminUserApiKeys } from "@/fetchers/admin/get-admin-user-api-keys";++export function adminUserApiKeysQueryKey(userId: string) {+ return ["admin", "user-api-keys", userId] as const;+}++function useAdminUserApiKeys(userId: string, enabled = true) {+ return useQuery({+ queryKey: adminUserApiKeysQueryKey(userId),+ queryFn: () => getAdminUserApiKeys(userId),+ enabled: enabled && userId !== "",+ });+}++export default useAdminUserApiKeys;diff --git a/apps/web/src/hooks/queries/admin/use-admin-user-sessions.ts b/apps/web/src/hooks/queries/admin/use-admin-user-sessions.tsnew file mode 100644index 000000000..fc3aad429--- /dev/null+++ b/apps/web/src/hooks/queries/admin/use-admin-user-sessions.ts@@ -0,0 +1,16 @@+import { useQuery } from "@tanstack/react-query";+import { getAdminUserSessions } from "@/fetchers/admin/get-admin-user-sessions";++export function adminUserSessionsQueryKey(userId: string) {+ return ["admin", "user-sessions", userId] as const;+}++function useAdminUserSessions(userId: string, enabled = true) {+ return useQuery({+ queryKey: adminUserSessionsQueryKey(userId),+ queryFn: () => getAdminUserSessions(userId),+ enabled: enabled && userId !== "",+ });+}++export default useAdminUserSessions;diff --git a/apps/web/src/hooks/queries/user/use-user-sessions.ts b/apps/web/src/hooks/queries/user/use-user-sessions.tsnew file mode 100644index 000000000..a0edd43af--- /dev/null+++ b/apps/web/src/hooks/queries/user/use-user-sessions.ts@@ -0,0 +1,13 @@+import { useQuery } from "@tanstack/react-query";+import { getUserSessions } from "@/fetchers/user/get-user-sessions";++export const USER_SESSIONS_QUERY_KEY = ["user", "sessions"] as const;++function useUserSessions() {+ return useQuery({+ queryKey: USER_SESSIONS_QUERY_KEY,+ queryFn: getUserSessions,+ });+}++export default useUserSessions;diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/security.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/security.tsxindex eaf7760e0..fe54bce81 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/security.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/security.tsx@@ -1,6 +1,7 @@import { createFileRoute } from "@tanstack/react-router";import { useTranslation } from "react-i18next";import { ChangePasswordSettings } from "@/components/account/change-password/change-password-settings";+import { ActiveSessionsSettings } from "@/components/account/sessions/active-sessions-settings";import PageTitle from "@/components/page-title";import { SettingsPage } from "@/components/settings/settings-page";@@ -21,6 +22,7 @@ function RouteComponent() {description={t("settings:securityPage.subtitle")}><ChangePasswordSettings />+ <ActiveSessionsSettings /></SettingsPage></>);diff --git a/i18n/az-AZ.json b/i18n/az-AZ.jsonindex 2e65caa1b..0acdd3213 100644--- a/i18n/az-AZ.json+++ b/i18n/az-AZ.json@@ -1601,7 +1601,8 @@"reactivate": "Yenidən aktiv et","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "Ən azı 8 simvol, cari paroldan fərqli.","dialogTitle": "Parolu dəyiş","passwordHint": "Başqa heç yerdə istifadə etmədiyiniz ən azı 8 simvol istifadə edin.",- "passwordTitle": "Parol"+ "passwordTitle": "Parol",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/de-DE.json b/i18n/de-DE.jsonindex 01c533938..0dc73b221 100644--- a/i18n/de-DE.json+++ b/i18n/de-DE.json@@ -614,7 +614,8 @@"reactivate": "Reaktivieren","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"edit": {"title": "Benutzer bearbeiten",@@ -709,7 +710,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"informationPage": {"pageTitle": "Profil",@@ -1762,7 +1788,15 @@"dialogDescription": "Mindestens 8 Zeichen, anders als das aktuelle Passwort.","dialogTitle": "Passwort ändern","passwordHint": "Verwende mindestens 8 Zeichen und ein Passwort, das du sonst nirgends nutzt.",- "passwordTitle": "Passwort"+ "passwordTitle": "Passwort",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab-URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/el-GR.json b/i18n/el-GR.jsonindex d1ab8a4b6..56bc1a57f 100644--- a/i18n/el-GR.json+++ b/i18n/el-GR.json@@ -1601,7 +1601,8 @@"reactivate": "Επανενεργοποίηση","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "Τουλάχιστον 8 χαρακτήρες, διαφορετικός από τον τρέχοντα.","dialogTitle": "Αλλαγή κωδικού πρόσβασης","passwordHint": "Χρησιμοποιήστε τουλάχιστον 8 χαρακτήρες που δεν χρησιμοποιείτε πουθενά αλλού.",- "passwordTitle": "Κωδικός πρόσβασης"+ "passwordTitle": "Κωδικός πρόσβασης",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/en-US.json b/i18n/en-US.jsonindex dc563b505..e8906dd55 100644--- a/i18n/en-US.json+++ b/i18n/en-US.json@@ -681,7 +681,8 @@"reactivate": "Reactivate","sendPasswordReset": "Send password reset link","sendVerification": "Resend verification email",- "markEmailVerified": "Mark email as verified"+ "markEmailVerified": "Mark email as verified",+ "security": "Sessions & API keys"},"edit": {"title": "Edit user",@@ -776,6 +777,31 @@},"uploadAvatar": "Upload","removeAvatar": "Remove"+ },+ "security": {+ "title": "Sessions & API keys: {{name}}",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "sessionsTitle": "Sessions",+ "sessionsEmpty": "Not signed in anywhere.",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "toastRevokedAll": "Sessions signed out.",+ "apiKeysTitle": "API keys",+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "disabled": "Disabled",+ "revokeKey": "Revoke",+ "revokingKey": "Revoking...",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key."}},"adminWorkspaces": {@@ -866,7 +892,8 @@"all": "All actions","user": "Users","session": "Sessions",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"loadError": "The audit log could not be loaded.","retry": "Retry",@@ -907,7 +934,8 @@"userVerificationSent": "Sent verification email","userEmailVerified": "Marked email as verified","userAvatarChanged": "Changed profile picture",- "userAvatarRemoved": "Removed profile picture"+ "userAvatarRemoved": "Removed profile picture",+ "apiKeyRevoked": "Revoked an API key"},"fields": {"name": "name",@@ -922,7 +950,9 @@"noRole": "No role","memberWithRole": "{{member}} as {{role}}","memberChange": "{{member}}: {{from}} → {{to}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"}},"informationPage": {@@ -2256,7 +2286,7 @@"securityPage": {"pageTitle": "Security","title": "Security",- "subtitle": "How you sign in to Kaneo.",+ "subtitle": "How you sign in to Kaneo, and where you're signed in.","sectionTitle": "Sign-in","currentPassword": "Current password","newPassword": "New password",@@ -2283,7 +2313,15 @@"passwordHint": "Use at least 8 characters you don't use anywhere else.","changePassword": "Change password","dialogTitle": "Change password",- "dialogDescription": "At least 8 characters, different from the current one."+ "dialogDescription": "At least 8 characters, different from the current one.",+ "sessions": {+ "title": "Active sessions",+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "toastRevokedOthers": "Other sessions signed out."+ }},"calendarFeeds": {"title": "Calendar feeds",@@ -2500,6 +2538,21 @@"newField": "New field","fieldsTitle": "Fields","fieldsDescription": "Drag to change the order they appear in on a task."+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "unknownDevice": "Unknown device",+ "thisDevice": "This device",+ "lastActive": "Active {{time}}",+ "signedIn": "Signed in {{date}}",+ "revoke": "Sign out",+ "revoking": "Signing out...",+ "revokeLabel": "Sign out {{device}}",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "loadError": "Couldn't load sessions.",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session."}},"navigation": {diff --git a/i18n/es-ES.json b/i18n/es-ES.jsonindex 71ae4fa7e..bd339c337 100644--- a/i18n/es-ES.json+++ b/i18n/es-ES.json@@ -1610,7 +1610,8 @@"reactivate": "Reactivar","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1739,7 +1740,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1772,7 +1798,15 @@"dialogDescription": "Al menos 8 caracteres, distinta de la actual.","dialogTitle": "Cambiar contraseña","passwordHint": "Usa al menos 8 caracteres que no uses en ningún otro sitio.",- "passwordTitle": "Contraseña"+ "passwordTitle": "Contraseña",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2495,13 +2529,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2519,7 +2555,10 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2542,6 +2581,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/fr-FR.json b/i18n/fr-FR.jsonindex cddafc8ab..59b18a6fa 100644--- a/i18n/fr-FR.json+++ b/i18n/fr-FR.json@@ -1610,7 +1610,8 @@"reactivate": "Réactiver","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Effacer la recherche","columns": {@@ -1739,7 +1740,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Sécurité","securityPage": {@@ -1772,7 +1798,15 @@"dialogDescription": "Au moins 8 caractères, différent du mot de passe actuel.","dialogTitle": "Changer le mot de passe","passwordHint": "Utilisez au moins 8 caractères et un mot de passe que vous n'utilisez nulle part ailleurs.",- "passwordTitle": "Mot de passe"+ "passwordTitle": "Mot de passe",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "URL de GitLab",@@ -2495,13 +2529,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2519,7 +2555,10 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2542,6 +2581,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/hi-IN.json b/i18n/hi-IN.jsonindex 32f8130d2..ef00da773 100644--- a/i18n/hi-IN.json+++ b/i18n/hi-IN.json@@ -1601,7 +1601,8 @@"reactivate": "फिर से सक्रिय करें","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "कम से कम 8 अक्षर, मौजूदा पासवर्ड से अलग।","dialogTitle": "पासवर्ड बदलें","passwordHint": "कम से कम 8 अक्षरों का ऐसा पासवर्ड उपयोग करें जो आप कहीं और उपयोग नहीं करते।",- "passwordTitle": "पासवर्ड"+ "passwordTitle": "पासवर्ड",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/id-ID.json b/i18n/id-ID.jsonindex f5bc5e769..628c698e5 100644--- a/i18n/id-ID.json+++ b/i18n/id-ID.json@@ -1592,7 +1592,8 @@"reactivate": "Aktifkan kembali","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1719,7 +1720,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1752,7 +1778,15 @@"dialogDescription": "Minimal 8 karakter, berbeda dari kata sandi saat ini.","dialogTitle": "Ubah kata sandi","passwordHint": "Gunakan minimal 8 karakter yang tidak Anda gunakan di tempat lain.",- "passwordTitle": "Kata sandi"+ "passwordTitle": "Kata sandi",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/it-IT.json b/i18n/it-IT.jsonindex 8efcac9f3..7850c9441 100644--- a/i18n/it-IT.json+++ b/i18n/it-IT.json@@ -1610,7 +1610,8 @@"reactivate": "Riattiva","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1739,7 +1740,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1772,7 +1798,15 @@"dialogDescription": "Almeno 8 caratteri, diversa da quella attuale.","dialogTitle": "Cambia password","passwordHint": "Usa almeno 8 caratteri e una password che non usi altrove.",- "passwordTitle": "Password"+ "passwordTitle": "Password",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2495,13 +2529,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2519,7 +2555,10 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2542,6 +2581,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/ja-JP.json b/i18n/ja-JP.jsonindex 307f54308..421cc71f0 100644--- a/i18n/ja-JP.json+++ b/i18n/ja-JP.json@@ -1592,7 +1592,8 @@"reactivate": "再有効化","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1719,7 +1720,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1752,7 +1778,15 @@"dialogDescription": "8 文字以上で、現在のパスワードとは異なるものにしてください。","dialogTitle": "パスワードを変更","passwordHint": "ほかで使っていない 8 文字以上のパスワードを使用してください。",- "passwordTitle": "パスワード"+ "passwordTitle": "パスワード",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/ko-KR.json b/i18n/ko-KR.jsonindex 1d87db1e6..8cc868388 100644--- a/i18n/ko-KR.json+++ b/i18n/ko-KR.json@@ -1592,7 +1592,8 @@"reactivate": "다시 활성화","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1719,7 +1720,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1752,7 +1778,15 @@"dialogDescription": "8자 이상이어야 하며 현재 비밀번호와 달라야 합니다.","dialogTitle": "비밀번호 변경","passwordHint": "다른 곳에서 사용하지 않는 8자 이상의 비밀번호를 사용하세요.",- "passwordTitle": "비밀번호"+ "passwordTitle": "비밀번호",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/mk-MK.json b/i18n/mk-MK.jsonindex a9ab19ba6..2e0f7cba0 100644--- a/i18n/mk-MK.json+++ b/i18n/mk-MK.json@@ -1601,7 +1601,8 @@"reactivate": "Повторно активирај","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "Најмалку 8 знаци, различна од тековната.","dialogTitle": "Смени лозинка","passwordHint": "Користи најмалку 8 знаци што не ги користиш никаде на друго место.",- "passwordTitle": "Лозинка"+ "passwordTitle": "Лозинка",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/nl-NL.json b/i18n/nl-NL.jsonindex 81cefe97c..54a02b51d 100644--- a/i18n/nl-NL.json+++ b/i18n/nl-NL.json@@ -1601,7 +1601,8 @@"reactivate": "Heractiveren","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "Minimaal 8 tekens, anders dan je huidige wachtwoord.","dialogTitle": "Wachtwoord wijzigen","passwordHint": "Gebruik minimaal 8 tekens en een wachtwoord dat je nergens anders gebruikt.",- "passwordTitle": "Wachtwoord"+ "passwordTitle": "Wachtwoord",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/pl-PL.json b/i18n/pl-PL.jsonindex ccf15d6ae..491649d95 100644--- a/i18n/pl-PL.json+++ b/i18n/pl-PL.json@@ -2304,7 +2304,8 @@"reactivate": "Aktywuj ponownie","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -2434,7 +2435,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -2467,7 +2493,15 @@"dialogDescription": "Co najmniej 8 znaków, inne niż obecne hasło.","dialogTitle": "Zmień hasło","passwordHint": "Użyj co najmniej 8 znaków, których nie używasz nigdzie indziej.",- "passwordTitle": "Hasło"+ "passwordTitle": "Hasło",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -3222,13 +3256,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -3246,7 +3282,11 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_few": "{{count}} sessions",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -3269,6 +3309,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"tasks": {diff --git a/i18n/pt-BR.json b/i18n/pt-BR.jsonindex 5137396a3..946d42d27 100644--- a/i18n/pt-BR.json+++ b/i18n/pt-BR.json@@ -1610,7 +1610,8 @@"reactivate": "Reativar","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1739,7 +1740,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1772,7 +1798,15 @@"dialogDescription": "Pelo menos 8 caracteres, diferente da atual.","dialogTitle": "Alterar senha","passwordHint": "Use pelo menos 8 caracteres que você não usa em nenhum outro lugar.",- "passwordTitle": "Senha"+ "passwordTitle": "Senha",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2495,13 +2529,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2519,7 +2555,10 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2542,6 +2581,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/ru-RU.json b/i18n/ru-RU.jsonindex ccb597ace..9c840b2d5 100644--- a/i18n/ru-RU.json+++ b/i18n/ru-RU.json@@ -1627,7 +1627,8 @@"reactivate": "Активировать снова","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1757,7 +1758,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1790,7 +1816,15 @@"dialogDescription": "Не менее 8 символов, отличный от текущего.","dialogTitle": "Сменить пароль","passwordHint": "Используйте не менее 8 символов, которые вы больше нигде не используете.",- "passwordTitle": "Пароль"+ "passwordTitle": "Пароль",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "URL GitLab",@@ -2545,13 +2579,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2569,7 +2605,11 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_few": "{{count}} sessions",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2592,6 +2632,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/tr-TR.json b/i18n/tr-TR.jsonindex 0f604cae2..366848505 100644--- a/i18n/tr-TR.json+++ b/i18n/tr-TR.json@@ -1601,7 +1601,8 @@"reactivate": "Yeniden etkinleştir","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1729,7 +1730,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1762,7 +1788,15 @@"dialogDescription": "En az 8 karakter olmalı ve mevcut paroladan farklı olmalı.","dialogTitle": "Parolayı değiştir","passwordHint": "Başka hiçbir yerde kullanmadığınız, en az 8 karakterlik bir parola kullanın.",- "passwordTitle": "Parola"+ "passwordTitle": "Parola",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2453,13 +2487,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2477,7 +2513,9 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2500,6 +2538,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/uk-UA.json b/i18n/uk-UA.jsonindex 25fed093a..61fcc08f6 100644--- a/i18n/uk-UA.json+++ b/i18n/uk-UA.json@@ -1619,7 +1619,8 @@"reactivate": "Активувати знову","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1749,7 +1750,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1782,7 +1808,15 @@"dialogDescription": "Щонайменше 8 символів, відмінний від поточного.","dialogTitle": "Змінити пароль","passwordHint": "Використовуйте щонайменше 8 символів, які ви більше ніде не використовуєте.",- "passwordTitle": "Пароль"+ "passwordTitle": "Пароль",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2537,13 +2571,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2561,7 +2597,11 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_few": "{{count}} sessions",+ "sessionCount_many": "{{count}} sessions",+ "sessionCount_one": "{{count}} session",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2584,6 +2624,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/vi-VN.json b/i18n/vi-VN.jsonindex 9362d4660..0a15fdca0 100644--- a/i18n/vi-VN.json+++ b/i18n/vi-VN.json@@ -1592,7 +1592,8 @@"reactivate": "Kích hoạt lại","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "Clear search","columns": {@@ -1719,7 +1720,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "Security","securityPage": {@@ -1752,7 +1778,15 @@"dialogDescription": "Ít nhất 8 ký tự, khác với mật khẩu hiện tại.","dialogTitle": "Đổi mật khẩu","passwordHint": "Dùng ít nhất 8 ký tự mà bạn không dùng ở nơi khác.",- "passwordTitle": "Mật khẩu"+ "passwordTitle": "Mật khẩu",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/zh-CN.json b/i18n/zh-CN.jsonindex e4ff221ee..2306ae6cc 100644--- a/i18n/zh-CN.json+++ b/i18n/zh-CN.json@@ -1592,7 +1592,8 @@"reactivate": "恢复","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "清除搜索","columns": {@@ -1719,7 +1720,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "安全","securityPage": {@@ -1752,7 +1778,15 @@"dialogDescription": "至少 8 个字符,且不能与当前密码相同。","dialogTitle": "修改密码","passwordHint": "请使用至少 8 个字符、且未在其他地方使用过的密码。",- "passwordTitle": "密码"+ "passwordTitle": "密码",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab 地址",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/i18n/zh-TW.json b/i18n/zh-TW.jsonindex 1235aa0d4..a05bac3a2 100644--- a/i18n/zh-TW.json+++ b/i18n/zh-TW.json@@ -1591,7 +1591,8 @@"reactivate": "重新啟用","markEmailVerified": "Mark email as verified","sendPasswordReset": "Send password reset link",- "sendVerification": "Resend verification email"+ "sendVerification": "Resend verification email",+ "security": "Sessions & API keys"},"clearSearch": "清除搜尋","columns": {@@ -1718,7 +1719,32 @@"verified": "Verified email"},"never": "Never",- "unverified": "Unverified"+ "unverified": "Unverified",+ "security": {+ "apiKeysDescription": "Only names and the first characters of keys are shown; the keys themselves are never visible.",+ "apiKeysEmpty": "No API keys.",+ "apiKeysLoadError": "Couldn't load API keys.",+ "apiKeysTitle": "API keys",+ "description": "Sign this user out or revoke their API keys. Changes take effect immediately and are recorded in the audit log.",+ "disabled": "Disabled",+ "lastUsed": "Last used {{time}}",+ "neverUsed": "Never used",+ "revokeAll": "Sign out everywhere",+ "revokeAllConfirmDescription": "Every session of this user ends right away. Their API keys keep working; revoke those separately.",+ "revokeAllConfirmTitle": "Sign {{name}} out everywhere?",+ "revokeAllSelfDescription": "Every other session of yours ends right away. This one stays signed in.",+ "revokeKey": "Revoke",+ "revokeKeyConfirmDescription": "The key is deleted and requests using it fail right away. This can't be undone.",+ "revokeKeyConfirmTitle": "Revoke {{name}}?",+ "revokeKeyLabel": "Revoke {{name}}",+ "revokingKey": "Revoking...",+ "sessionsEmpty": "Not signed in anywhere.",+ "sessionsTitle": "Sessions",+ "title": "Sessions & API keys: {{name}}",+ "toastKeyRevoked": "API key revoked.",+ "toastKeyRevokeError": "Couldn't revoke the API key.",+ "toastRevokedAll": "Sessions signed out."+ }},"security": "安全性","securityPage": {@@ -1751,7 +1777,15 @@"dialogDescription": "至少 8 個字元,且不可與目前的密碼相同。","dialogTitle": "變更密碼","passwordHint": "請使用至少 8 個字元,且未在其他地方使用過的密碼。",- "passwordTitle": "密碼"+ "passwordTitle": "密碼",+ "sessions": {+ "description": "Browsers and devices signed in to your account. Sign out any you don't recognize.",+ "revokeOthers": "Sign out other sessions",+ "revokeOthersConfirmDescription": "Every other browser and device is signed out right away. This one stays signed in, and API keys keep working.",+ "revokeOthersConfirmTitle": "Sign out all other sessions?",+ "title": "Active sessions",+ "toastRevokedOthers": "Other sessions signed out."+ }},"gitlabIntegration": {"baseUrlLabel": "GitLab URL",@@ -2411,13 +2445,15 @@"userAvatarRemoved": "Removed profile picture","userEmailVerified": "Marked email as verified","userPasswordResetSent": "Sent password reset link",- "userVerificationSent": "Sent verification email"+ "userVerificationSent": "Sent verification email",+ "apiKeyRevoked": "Revoked an API key"},"categories": {"all": "All actions","session": "Sessions","user": "Users",- "workspace": "Workspaces"+ "workspace": "Workspaces",+ "apiKey": "API keys"},"categoryLabel": "Filter by category","clearFilter": "Show all actions",@@ -2435,7 +2471,8 @@"memberWithRole": "{{member}} as {{role}}","noRole": "No role","reason": "Reason: {{reason}}",- "createdWithRole": "Role: {{role}}"+ "createdWithRole": "Role: {{role}}",+ "sessionCount_other": "{{count}} sessions"},"directoryTitle": "Recorded actions","emptyTitle": "No actions recorded",@@ -2458,6 +2495,21 @@},"title": "Audit log","unknownActor": "Unknown"+ },+ "sessions": {+ "device": "{{browser}} on {{os}}",+ "lastActive": "Active {{time}}",+ "loadError": "Couldn't load sessions.",+ "revoke": "Sign out",+ "revokeConfirmDescription": "That session ends right away and has to sign in again.",+ "revokeConfirmTitle": "Sign out {{device}}?",+ "revokeLabel": "Sign out {{device}}",+ "revoking": "Signing out...",+ "signedIn": "Signed in {{date}}",+ "thisDevice": "This device",+ "toastRevoked": "Session signed out.",+ "toastRevokeError": "Couldn't sign out the session.",+ "unknownDevice": "Unknown device"}},"navigation": {diff --git a/tests/api-integration/admin-user-sessions-api-keys.test.ts b/tests/api-integration/admin-user-sessions-api-keys.test.tsnew file mode 100644index 000000000..67bff31dd--- /dev/null+++ b/tests/api-integration/admin-user-sessions-api-keys.test.ts@@ -0,0 +1,316 @@+import { eq } from "drizzle-orm";+import { afterEach, beforeEach, describe, expect, it } from "vite-plus/test";+import { auth } from "../../apps/api/src/auth";+import db, { schema } from "../../apps/api/src/database";+import { createApp } from "../../apps/api/src/index";+import { SESSION_ENDED_CLOSE_CODE } from "../../apps/api/src/ws";+import { readAuditLog } from "./helpers/admin/read-audit-log";+import { signIn, signUpWithSession } from "./helpers/auth-session";+import { resetTestDatabase } from "./helpers/database";+import {+ connectSocket,+ disconnectSockets,+ FIREFOX_ON_LINUX,+ meStatus,+ sessionIdOf,+ sessionIdsOf,+ sessionTokens,+} from "./helpers/sessions/session-fixtures";++type App = ReturnType<typeof createApp>["app"];+type Account = { userId: string; cookies: string };++let app: App;+let admin: Account;+let target: Account;+let targetLaptop: string;++function call(+ method: "GET" | "DELETE",+ path: string,+ headers: Record<string, string>,+) {+ return app.request(`/api/admin/users/${path}`, {+ method,+ headers: {+ origin: "http://localhost:5173",+ "user-agent": "admin-session-test",+ ...headers,+ },+ });+}++const asAdmin = (method: "GET" | "DELETE", path: string) =>+ call(method, path, { cookie: admin.cookies });++async function createKey(userId: string, name: string) {+ return auth.api.createApiKey({ body: { userId, name } });+}++const keyStatus = (key: string) =>+ app+ .request("/api/user/me", { headers: { "x-api-key": key } })+ .then((response) => response.status);++beforeEach(async () => {+ await resetTestDatabase();+ ({ app } = createApp());+ admin = await signUpWithSession(app, {+ email: "[email protected]",+ name: "Ada Admin",+ role: "admin",+ });+ target = await signUpWithSession(app, {+ email: "[email protected]",+ name: "Tom Target",+ role: "user",+ });+ targetLaptop = await signIn(app, "[email protected]", {+ "user-agent": FIREFOX_ON_LINUX,+ });+});++afterEach(() => disconnectSockets());++describe("API integration: admin access to sessions and API keys", () => {+ it("rejects non-admins, API keys, and anonymous callers on every route", async () => {+ const laptopId = await sessionIdOf(targetLaptop);+ const { id: keyId, key: targetKey } = await createKey(+ target.userId,+ "Target key",+ );+ const { key: adminKey } = await createKey(admin.userId, "Admin key");+ const routes: Array<["GET" | "DELETE", string]> = [+ ["GET", `${target.userId}/sessions`],+ ["DELETE", `${target.userId}/sessions/${laptopId}`],+ ["DELETE", `${target.userId}/sessions`],+ ["GET", `${target.userId}/api-keys`],+ ["DELETE", `${target.userId}/api-keys/${keyId}`],+ ];++ for (const [method, path] of routes) {+ expect(+ (await call(method, path, { cookie: target.cookies })).status,+ path,+ ).toBe(403);+ expect(+ (await call(method, path, { "x-api-key": adminKey })).status,+ path,+ ).toBe(403);+ expect((await call(method, path, {})).status, path).toBe(401);+ }+ expect(await meStatus(app, targetLaptop)).toBe(200);+ expect(await keyStatus(targetKey)).toBe(200);+ expect(await readAuditLog()).toEqual([]);+ });++ it("lists a user's sessions without tokens", async () => {+ const response = await asAdmin("GET", `${target.userId}/sessions`);++ expect(response.status).toBe(200);+ expect(response.headers.get("cache-control")).toBe("no-store");+ const { sessions } = (await response.json()) as {+ sessions: Array<Record<string, unknown>>;+ };+ expect(sessions.map((session) => session.id).sort()).toEqual(+ await sessionIdsOf(target.userId),+ );+ expect(sessions.every((session) => session.current === false)).toBe(true);+ expect(+ sessions.find((session) => session.browser === "Firefox"),+ ).toMatchObject({ os: "Linux" });+ const text = JSON.stringify(sessions);+ for (const token of await sessionTokens())+ expect(text).not.toContain(token);+ });++ it("signs out one session at once and audits it once, without the token", async () => {+ const laptopId = await sessionIdOf(targetLaptop);+ const tokensBeforeRevocation = await sessionTokens();+ const laptopSocket = connectSocket(target.userId, laptopId);+ const otherSocket = connectSocket(+ target.userId,+ await sessionIdOf(target.cookies),+ );++ const response = await asAdmin(+ "DELETE",+ `${target.userId}/sessions/${laptopId}`,+ );++ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({ revoked: 1 });+ expect(await meStatus(app, targetLaptop)).toBe(401);+ expect(await meStatus(app, target.cookies)).toBe(200);+ expect(laptopSocket.close).toHaveBeenCalledWith(+ SESSION_ENDED_CLOSE_CODE,+ "Session ended",+ );+ expect(otherSocket.close).not.toHaveBeenCalled();+ const rows = await readAuditLog();+ expect(rows).toHaveLength(1);+ expect(rows[0]).toMatchObject({+ action: "session.revoked",+ actorUserId: admin.userId,+ targetType: "user",+ targetId: target.userId,+ targetLabel: "[email protected]",+ metadata: { sessionId: laptopId },+ userAgent: "admin-session-test",+ });+ const auditText = JSON.stringify(rows);+ for (const token of tokensBeforeRevocation)+ expect(auditText).not.toContain(token);+ });++ it("refuses the admin's current session and sessions of other users", async () => {+ const adminSessionId = await sessionIdOf(admin.cookies);+ const response = await asAdmin(+ "DELETE",+ `${target.userId}/sessions/${adminSessionId}`,+ );+ const laptopId = await sessionIdOf(targetLaptop);+ const unknownUser = await asAdmin(+ "DELETE",+ `missing-user/sessions/${laptopId}`,+ );++ expect(response.status).toBe(409);+ expect(unknownUser.status).toBe(404);+ const otherAdminSession = await signIn(app, "[email protected]");+ const crossUser = await asAdmin(+ "DELETE",+ `${target.userId}/sessions/${await sessionIdOf(otherAdminSession)}`,+ );+ expect(crossUser.status).toBe(404);+ expect(await meStatus(app, otherAdminSession)).toBe(200);+ expect(await meStatus(app, targetLaptop)).toBe(200);+ expect(await readAuditLog()).toEqual([]);+ });++ it("signs out every session of a user and audits it once", async () => {+ const tokensBeforeRevocation = await sessionTokens();+ const sockets = await Promise.all(+ [target.cookies, targetLaptop].map(async (cookies) =>+ connectSocket(target.userId, await sessionIdOf(cookies)),+ ),+ );+ const { key } = await createKey(target.userId, "Kept key");++ const response = await asAdmin("DELETE", `${target.userId}/sessions`);++ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({ revoked: 3 });+ expect(await sessionIdsOf(target.userId)).toEqual([]);+ expect(await meStatus(app, target.cookies)).toBe(401);+ expect(await meStatus(app, targetLaptop)).toBe(401);+ for (const socket of sockets)+ expect(socket.close).toHaveBeenCalledWith(+ SESSION_ENDED_CLOSE_CODE,+ "Session ended",+ );+ expect(await keyStatus(key)).toBe(200);+ const rows = await readAuditLog();+ expect(rows).toHaveLength(1);+ expect(rows[0]).toMatchObject({+ action: "session.revoked_all",+ targetId: target.userId,+ metadata: { count: 3 },+ });+ for (const token of tokensBeforeRevocation)+ expect(JSON.stringify(rows)).not.toContain(token);++ const again = await asAdmin("DELETE", `${target.userId}/sessions`);+ expect(await again.json()).toEqual({ revoked: 0 });+ expect(await readAuditLog()).toHaveLength(1);+ });++ it("keeps the admin's own current session when they sign themselves out everywhere", async () => {+ const otherAdminSession = await signIn(app, "[email protected]");++ const list = await asAdmin("GET", `${admin.userId}/sessions`);+ const { sessions } = (await list.json()) as {+ sessions: Array<{ id: string; current: boolean }>;+ };+ const response = await asAdmin("DELETE", `${admin.userId}/sessions`);++ expect(sessions[0]).toEqual(+ expect.objectContaining({+ id: await sessionIdOf(admin.cookies),+ current: true,+ }),+ );+ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({ revoked: 2 });+ expect(await meStatus(app, admin.cookies)).toBe(200);+ expect(await meStatus(app, otherAdminSession)).toBe(401);+ });++ it("lists API keys as metadata only", async () => {+ const created = await createKey(target.userId, "CI deploys");+ await createKey(admin.userId, "Admin key");+ const [stored] = await db+ .select({ key: schema.apikeyTable.key })+ .from(schema.apikeyTable)+ .where(eq(schema.apikeyTable.id, created.id));++ const response = await asAdmin("GET", `${target.userId}/api-keys`);++ expect(response.status).toBe(200);+ const { apiKeys } = (await response.json()) as {+ apiKeys: Array<Record<string, unknown>>;+ };+ expect(apiKeys).toHaveLength(1);+ expect(Object.keys(apiKeys[0] ?? {}).sort()).toEqual([+ "createdAt",+ "enabled",+ "expiresAt",+ "id",+ "lastUsedAt",+ "name",+ "start",+ ]);+ expect(apiKeys[0]).toMatchObject({+ id: created.id,+ name: "CI deploys",+ enabled: true,+ expiresAt: null,+ lastUsedAt: null,+ });+ const text = JSON.stringify(apiKeys);+ expect(text).not.toContain(created.key);+ expect(text).not.toContain(stored?.key);+ });++ it("revokes a user's API key at once and audits it once", async () => {+ const { id, key } = await createKey(target.userId, "CI deploys");+ expect(await keyStatus(key)).toBe(200);++ const response = await asAdmin("DELETE", `${target.userId}/api-keys/${id}`);++ expect(response.status).toBe(200);+ expect(await keyStatus(key)).toBe(401);+ const rows = await readAuditLog();+ expect(rows).toHaveLength(1);+ expect(rows[0]).toMatchObject({+ action: "api_key.revoked",+ targetType: "user",+ targetId: target.userId,+ metadata: { keyId: id, keyName: "CI deploys" },+ });+ expect(JSON.stringify(rows)).not.toContain(key);+ expect(+ (await asAdmin("DELETE", `${target.userId}/api-keys/${id}`)).status,+ ).toBe(404);+ });++ it("does not revoke a key through another user's path", async () => {+ const { id, key } = await createKey(admin.userId, "Admin key");++ const response = await asAdmin("DELETE", `${target.userId}/api-keys/${id}`);++ expect(response.status).toBe(404);+ expect(await keyStatus(key)).toBe(200);+ expect(await readAuditLog()).toEqual([]);+ });+});diff --git a/tests/api-integration/helpers/auth-session.ts b/tests/api-integration/helpers/auth-session.tsindex 26e831158..a7acf83de 100644--- a/tests/api-integration/helpers/auth-session.ts+++ b/tests/api-integration/helpers/auth-session.ts@@ -18,10 +18,14 @@ function collectCookies(response: Response) {return [...jar].map(([name, value]) => `${name}=${value}`).join("; ");}-async function signIn(app: App, email: string) {+export async function signIn(+ app: App,+ email: string,+ headers: Record<string, string> = {},+) {const response = await app.request("/api/auth/sign-in/email", {method: "POST",- headers: { "content-type": "application/json" },+ headers: { "content-type": "application/json", ...headers },body: JSON.stringify({ email, password: PASSWORD }),});expect(response.status).toBe(200);diff --git a/tests/api-integration/helpers/sessions/session-fixtures.ts b/tests/api-integration/helpers/sessions/session-fixtures.tsnew file mode 100644index 000000000..8dfbf8f48--- /dev/null+++ b/tests/api-integration/helpers/sessions/session-fixtures.ts@@ -0,0 +1,66 @@+import { eq } from "drizzle-orm";+import type { WSContext } from "hono/ws";+import { vi } from "vite-plus/test";+import db, { schema } from "../../../../apps/api/src/database";+import type { createApp } from "../../../../apps/api/src/index";+import {+ addUserConnection,+ removeUserConnection,+} from "../../../../apps/api/src/ws";++type App = ReturnType<typeof createApp>["app"];++export const FIREFOX_ON_LINUX =+ "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0";++/** The session row behind a cookie jar, found by the session token in it. */+export async function sessionIdOf(cookies: string) {+ const token = decodeURIComponent(+ /better-auth\.session_token=([^;]+)/.exec(cookies)?.[1] ?? "",+ ).split(".")[0];+ const [session] = await db+ .select({ id: schema.sessionTable.id })+ .from(schema.sessionTable)+ .where(eq(schema.sessionTable.token, token ?? ""));+ if (!session) throw new Error("No session for these cookies");+ return session.id;+}++export async function sessionIdsOf(userId: string) {+ const rows = await db+ .select({ id: schema.sessionTable.id })+ .from(schema.sessionTable)+ .where(eq(schema.sessionTable.userId, userId));+ return rows.map((row) => row.id).sort();+}++export async function sessionTokens() {+ const rows = await db+ .select({ token: schema.sessionTable.token })+ .from(schema.sessionTable);+ return rows.map((row) => row.token);+}++const connected: Array<() => void> = [];++/** A fake realtime connection registered for a session. */+export function connectSocket(userId: string, sessionId: string | null) {+ const socket = { send: vi.fn(), close: vi.fn() };+ const connection = addUserConnection(+ userId,+ socket as unknown as WSContext,+ sessionId,+ );+ connected.push(() => removeUserConnection(userId, connection));+ return socket;+}++export function disconnectSockets() {+ for (const disconnect of connected.splice(0)) disconnect();+}++export function meStatus(app: App, cookies: string) {+ return app+ .request("/api/user/me", { headers: { cookie: cookies } })+ .then((response) => response.status);+}diff --git a/tests/api-integration/user-sessions.test.ts b/tests/api-integration/user-sessions.test.tsnew file mode 100644index 000000000..f014ff33e--- /dev/null+++ b/tests/api-integration/user-sessions.test.ts@@ -0,0 +1,174 @@+import { afterEach, beforeEach, describe, expect, it } from "vite-plus/test";+import { auth } from "../../apps/api/src/auth";+import { createApp } from "../../apps/api/src/index";+import { SESSION_ENDED_CLOSE_CODE } from "../../apps/api/src/ws";+import { signIn, signUpWithSession } from "./helpers/auth-session";+import { resetTestDatabase } from "./helpers/database";+import {+ connectSocket,+ disconnectSockets,+ FIREFOX_ON_LINUX,+ meStatus,+ sessionIdOf,+ sessionIdsOf,+ sessionTokens,+} from "./helpers/sessions/session-fixtures";++type App = ReturnType<typeof createApp>["app"];+type SessionList = {+ sessions: Array<Record<string, unknown> & { id: string; current: boolean }>;+};++let app: App;+let me: { userId: string; cookies: string };+let laptop: string;++const listSessions = (headers: Record<string, string>) =>+ app.request("/api/user/sessions", { headers });++const revokeSession = (sessionId: string, headers: Record<string, string>) =>+ app.request(`/api/user/sessions/${sessionId}`, {+ method: "DELETE",+ headers: { origin: "http://localhost:5173", ...headers },+ });++beforeEach(async () => {+ await resetTestDatabase();+ ({ app } = createApp());+ me = await signUpWithSession(app, {+ email: "[email protected]",+ name: "Mia Me",+ });+ laptop = await signIn(app, "[email protected]", {+ "user-agent": FIREFOX_ON_LINUX,+ });+});++afterEach(() => disconnectSockets());++describe("API integration: own sessions", () => {+ it("lists the caller's sessions without tokens, current first", async () => {+ const response = await listSessions({ cookie: me.cookies });++ expect(response.status).toBe(200);+ expect(response.headers.get("cache-control")).toBe("no-store");+ const body = (await response.json()) as SessionList;+ expect(body.sessions).toHaveLength(3);+ expect(body.sessions[0]).toMatchObject({+ id: await sessionIdOf(me.cookies),+ current: true,+ });+ expect(body.sessions.filter((session) => session.current)).toHaveLength(1);+ const laptopId = await sessionIdOf(laptop);+ const laptopSession = body.sessions.find(({ id }) => id === laptopId);+ expect(laptopSession).toMatchObject({+ browser: "Firefox",+ os: "Linux",+ current: false,+ });+ expect(Object.keys(laptopSession ?? {}).sort()).toEqual([+ "browser",+ "createdAt",+ "current",+ "expiresAt",+ "id",+ "ipAddress",+ "lastActiveAt",+ "os",+ ]);+ const text = JSON.stringify(body);+ for (const token of await sessionTokens())+ expect(text).not.toContain(token);+ });++ it("signs out another session at once, closing only its sockets", async () => {+ const laptopId = await sessionIdOf(laptop);+ const currentId = await sessionIdOf(me.cookies);+ const laptopSocket = connectSocket(me.userId, laptopId);+ const currentSocket = connectSocket(me.userId, currentId);++ const response = await revokeSession(laptopId, { cookie: me.cookies });++ expect(response.status).toBe(200);+ expect(await response.json()).toEqual({ revoked: 1 });+ expect(await meStatus(app, laptop)).toBe(401);+ expect(await meStatus(app, me.cookies)).toBe(200);+ expect(laptopSocket.close).toHaveBeenCalledWith(+ SESSION_ENDED_CLOSE_CODE,+ "Session ended",+ );+ expect(currentSocket.close).not.toHaveBeenCalled();+ });++ it("refuses to end the current session; that is signing out", async () => {+ const response = await revokeSession(await sessionIdOf(me.cookies), {+ cookie: me.cookies,+ });++ expect(response.status).toBe(409);+ expect(await meStatus(app, me.cookies)).toBe(200);+ });++ it("cannot see or end another user's sessions", async () => {+ const other = await signUpWithSession(app, {+ email: "[email protected]",+ name: "Oli Other",+ });+ const otherSessionId = await sessionIdOf(other.cookies);++ const list = (await (+ await listSessions({ cookie: me.cookies })+ ).json()) as SessionList;+ const response = await revokeSession(otherSessionId, {+ cookie: me.cookies,+ });++ expect(list.sessions.map((session) => session.id)).not.toContain(+ otherSessionId,+ );+ expect(response.status).toBe(404);+ expect(await sessionIdsOf(other.userId)).toContain(otherSessionId);+ expect(await meStatus(app, other.cookies)).toBe(200);+ });++ it("rejects API keys and anonymous callers", async () => {+ const { key } = await auth.api.createApiKey({+ body: { userId: me.userId, name: "Sessions test" },+ });+ const laptopId = await sessionIdOf(laptop);++ expect((await listSessions({ "x-api-key": key })).status).toBe(403);+ expect((await revokeSession(laptopId, { "x-api-key": key })).status).toBe(+ 403,+ );+ expect((await listSessions({})).status).toBe(401);+ expect((await revokeSession(laptopId, {})).status).toBe(401);+ expect(await meStatus(app, laptop)).toBe(200);+ });++ it("closes the sockets of sessions ended by revoke-other-sessions", async () => {+ const laptopSocket = connectSocket(me.userId, await sessionIdOf(laptop));+ const currentSocket = connectSocket(+ me.userId,+ await sessionIdOf(me.cookies),+ );++ const response = await app.request("/api/auth/revoke-other-sessions", {+ method: "POST",+ headers: {+ cookie: me.cookies,+ origin: "http://localhost:5173",+ "content-type": "application/json",+ },+ body: "{}",+ });++ expect(response.status).toBe(200);+ expect(await meStatus(app, laptop)).toBe(401);+ expect(laptopSocket.close).toHaveBeenCalledWith(+ SESSION_ENDED_CLOSE_CODE,+ "Session ended",+ );+ expect(currentSocket.close).not.toHaveBeenCalled();+ });+});