diff --git a/apps/dokploy/server/api/routers/user.ts b/apps/dokploy/server/api/routers/user.ts index 538cbe7f5..fc3b29d6e 100644 --- a/apps/dokploy/server/api/routers/user.ts +++ b/apps/dokploy/server/api/routers/user.ts @@ -23,6 +23,7 @@ import { apiUpdateUser, invitation, member, + session, user, } from "@dokploy/server/db/schema"; import { @@ -32,7 +33,7 @@ import { import { hasValidLicense } from "@dokploy/server/services/proprietary/license-key"; import { TRPCError } from "@trpc/server"; import * as bcrypt from "bcrypt"; -import { and, asc, eq, gt } from "drizzle-orm"; +import { and, asc, eq, gt, ne } from "drizzle-orm"; import { z } from "zod"; import { audit } from "@/server/api/utils/audit"; import { @@ -229,6 +230,15 @@ export const userRouter = createTRPCRouter({ password: bcrypt.hashSync(input.password, 10), }) .where(eq(account.userId, ctx.user.id)); + + await db + .delete(session) + .where( + and( + eq(session.userId, ctx.user.id), + ne(session.id, ctx.session.id), + ), + ); } try {