fix: auth query fallback (resolves #4)
This commit is contained in:
+2
-1
@@ -28,12 +28,13 @@ export async function getSession(event: Event) {
|
|||||||
const session = await event.locals.auth();
|
const session = await event.locals.auth();
|
||||||
if (!session) return null;
|
if (!session) return null;
|
||||||
if (!session.user) error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
if (!session.user) error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
||||||
|
if (!session?.user?.email) return null;
|
||||||
|
|
||||||
const res = await db
|
const res = await db
|
||||||
.select({ id: users.id })
|
.select({ id: users.id })
|
||||||
.from(users)
|
.from(users)
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.where(eq(users.email, session.user.email ?? 'eaf9302d-9525-4f3e-8147-9620d2076f67')); //uuid as default to find nothing
|
.where(eq(users.email, session.user.email));
|
||||||
|
|
||||||
if (!res[0]?.id) {
|
if (!res[0]?.id) {
|
||||||
error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
||||||
|
|||||||
Reference in New Issue
Block a user