This commit is contained in:
parent
f525d1afe5
commit
ba12d413dc
@ -17,6 +17,9 @@ export default fp(async (fastify) => {
|
|||||||
try {
|
try {
|
||||||
const sessionId = auth.readSessionCookie(req.headers.cookie ?? '')
|
const sessionId = auth.readSessionCookie(req.headers.cookie ?? '')
|
||||||
|
|
||||||
|
if (!sessionId)
|
||||||
|
return
|
||||||
|
|
||||||
const { session, user } = await auth.validateSession(sessionId ?? '')
|
const { session, user } = await auth.validateSession(sessionId ?? '')
|
||||||
|
|
||||||
if (session && session.fresh) {
|
if (session && session.fresh) {
|
||||||
|
|||||||
@ -70,8 +70,6 @@ export default function (fastify: FastifyInstance) {
|
|||||||
const session = await auth.createSession(user.id, {})
|
const session = await auth.createSession(user.id, {})
|
||||||
const cookie = auth.createSessionCookie(session.id)
|
const cookie = auth.createSessionCookie(session.id)
|
||||||
|
|
||||||
cookie.attributes.secure = false
|
|
||||||
|
|
||||||
reply.setCookie(cookie.name, cookie.value, cookie.attributes)
|
reply.setCookie(cookie.name, cookie.value, cookie.attributes)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user