mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-27 09:32:20 -05:00
fix(admin): impersonate user session expiration (#1471)
* fix: impersonate user session expiration * console leak
This commit is contained in:
committed by
GitHub
parent
9c3b5c377f
commit
072c597500
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user