mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
fix: currency converter and auth apis
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import config from "@/lib/config"
|
||||
import { createUserDefaults } from "@/models/defaults"
|
||||
import { getSelfHostedUser } from "@/models/users"
|
||||
import { getSelfHostedUser, getUserByEmail } from "@/models/users"
|
||||
import { User } from "@prisma/client"
|
||||
import { betterAuth } from "better-auth"
|
||||
import { prismaAdapter } from "better-auth/adapters/prisma"
|
||||
import { APIError } from "better-auth/api"
|
||||
import { nextCookies } from "better-auth/next-js"
|
||||
import { emailOTP } from "better-auth/plugins/email-otp"
|
||||
import { headers } from "next/headers"
|
||||
@@ -56,6 +57,10 @@ export const auth = betterAuth({
|
||||
otpLength: 6,
|
||||
expiresIn: 10 * 60, // 10 minutes
|
||||
sendVerificationOTP: async ({ email, otp }) => {
|
||||
const user = await getUserByEmail(email)
|
||||
if (!user) {
|
||||
throw new APIError("NOT_FOUND", { message: "User with this email does not exist" })
|
||||
}
|
||||
await sendOTPCodeEmail({ email, otp })
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user