cookie now supports http and https
This commit is contained in:
@@ -3,6 +3,9 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
const body = await readBody(event)
|
||||
|
||||
const is_https = await getRequestProtocol(event) == "https"
|
||||
//console.log(is_https)
|
||||
|
||||
if ( !body.email || !body.password )
|
||||
throw createError({ statusCode: 400, message: "Bad form. Use e-mail and password" })
|
||||
//console.log(body)
|
||||
@@ -32,6 +35,11 @@ export default defineEventHandler(async (event) => {
|
||||
secure: {
|
||||
user_id: body.id
|
||||
}
|
||||
}, {
|
||||
cookie: {
|
||||
secure: is_https,
|
||||
sameSite: is_https ? 'none' : 'lax'
|
||||
}
|
||||
})
|
||||
console.log(await getUserSession(event))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user