feat: custom auth preparations

This commit is contained in:
zomars committed 2023-06-26 20:45:50 -07:00
1 parent 4fe69b5864
commit c2e91b8378
5 files changed
+10 -10

No files matched your search

@@ -14,7 +14,8 @@ import { identityProviderNameMap } from "./identityProviderNameMap";
export default function CalComAdapter(prismaClient: PrismaClient) {
return {
createUser: (data: Prisma.UserCreateInput) => prismaClient.user.create({ data }),
getUser: (id: User["id"]) => prismaClient.user.findUnique({ where: { id } }),
getUser: (id: string | number) =>
prismaClient.user.findUnique({ where: { id: typeof id === "string" ? parseInt(id) : id } }),
getUserByEmail: (email: User["email"]) => prismaClient.user.findUnique({ where: { email } }),
async getUserByAccount(provider_providerAccountId: {
providerAccountId: Account["providerAccountId"];
@@ -15,7 +15,7 @@ const transporter = nodemailer.createTransport<TransportOptions>({
const sendVerificationRequest = async ({ identifier, url }: SendVerificationRequestParams) => {
const emailsDir = path.resolve(process.cwd(), "..", "..", "packages/emails", "templates");
const originalUrl = new URL(url);
const webappUrl = new URL(WEBAPP_URL);
const webappUrl = new URL(process.env.NEXTAUTH_URL || WEBAPP_URL);
if (originalUrl.origin !== webappUrl.origin) {
url = url.replace(originalUrl.origin, webappUrl.origin);
}