Fix Hacky Fallback in Auth Query #15
@@ -28,12 +28,13 @@ export async function getSession(event: Event) {
|
||||
const session = await event.locals.auth();
|
||||
if (!session) return null;
|
||||
if (!session.user) error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
||||
if (!session?.user?.email) return null;
|
||||
|
||||
const res = await db
|
||||
.select({ id: users.id })
|
||||
.from(users)
|
||||
.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) {
|
||||
error(403, { message: 'Di gits garnid. Vilich nomau usloge u iiloge?' });
|
||||
|
||||
Reference in New Issue
Block a user