fix(admin): impersonate user session expiration (#1471)

* fix: impersonate user session expiration

* console leak
This commit is contained in:
KinfeMichael Tariku
2025-02-20 21:52:26 +03:00
committed by GitHub
parent 9c3b5c377f
commit 072c597500
2 changed files with 10 additions and 7 deletions

View File

@@ -34,17 +34,21 @@ export const getSession = <Option extends BetterAuthOptions>() =>
* and fetch the session from the database
*/
disableCookieCache: z
.boolean({
description:
"Disable cookie cache and fetch session from database",
})
.or(z.string().transform((v) => v === "true"))
.optional(
z
.boolean({
description:
"Disable cookie cache and fetch session from database",
})
.or(z.string().transform((v) => v === "true")),
)
.optional(),
disableRefresh: z
.boolean({
description:
"Disable session refresh. Useful for checking session status, without updating the session",
})
.or(z.string().transform((v) => v === "true"))
.optional(),
}),
),
@@ -171,7 +175,6 @@ export const getSession = <Option extends BetterAuthOptions>() =>
}
return ctx.json(null);
}
/**
* We don't need to update the session if the user doesn't want to be remembered
* or if the session refresh is disabled

View File

@@ -190,7 +190,6 @@ export const createInternalAdapter = (
const data: Omit<Session, "id"> = {
ipAddress: request ? getIp(request, ctx.options) || "" : "",
userAgent: headers?.get("user-agent") || "",
...rest,
/**
* If the user doesn't want to be remembered
* set the session to expire in 1 day.
@@ -203,6 +202,7 @@ export const createInternalAdapter = (
token: generateId(32),
createdAt: new Date(),
updatedAt: new Date(),
...rest,
};
const res = await createWithHooks(
data,