Error
Something went wrong.
This commit is contained in:
+2
-7
@@ -1,9 +1,8 @@
|
||||
|
||||
import NextAuth from 'next-auth';
|
||||
import { authConfig } from './auth.config';
|
||||
import Credentials from 'next-auth/providers/credentials';
|
||||
import { z } from 'zod';
|
||||
import db from '@/lib/db';
|
||||
import { getUserByEmail } from '@/lib/actions/user';
|
||||
|
||||
export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
...authConfig,
|
||||
@@ -17,9 +16,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
if (parsedCredentials.success) {
|
||||
const { email, password } = parsedCredentials.data;
|
||||
|
||||
const userStmt = db.prepare('SELECT * FROM users WHERE email = ?');
|
||||
const user = userStmt.get(email) as any;
|
||||
|
||||
const user = await getUserByEmail(email);
|
||||
if (!user) return null;
|
||||
|
||||
// WARNING: Storing passwords in plaintext is insecure.
|
||||
@@ -39,5 +36,3 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
|
||||
}),
|
||||
]
|
||||
});
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
Reference in New Issue
Block a user