feat(auth) : sync Sudloh profiles and validate sessions
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import "server-only";
|
||||
|
||||
import { headers } from "next/headers";
|
||||
import { getAuth } from "@/lib/auth/server";
|
||||
import { getVerifiedSession } from "@/lib/auth/server";
|
||||
import { getDb } from "@/db";
|
||||
import { users } from "@/db/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
@@ -9,7 +8,7 @@ import { HttpError } from "@/lib/security/http";
|
||||
import { getRedisClient, redisEventChannel } from "@/lib/redis/client";
|
||||
|
||||
export async function requireCommissionUser() {
|
||||
const session = await getAuth().api.getSession({ headers: await headers() });
|
||||
const session = await getVerifiedSession();
|
||||
if (!session?.user) throw new HttpError(401, "unauthorized");
|
||||
const [user] = await getDb().select().from(users).where(eq(users.id, session.user.id)).limit(1);
|
||||
if (!user || user.banned) throw new HttpError(401, "unauthorized");
|
||||
|
||||
Reference in New Issue
Block a user