diff --git a/local.db-shm b/local.db-shm index a588756..2de882f 100644 Binary files a/local.db-shm and b/local.db-shm differ diff --git a/local.db-wal b/local.db-wal index fb7ad42..559a2f2 100644 Binary files a/local.db-wal and b/local.db-wal differ diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index 9cc5077..901e8d7 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -1,8 +1,6 @@ -import { handlers, auth, signIn, signOut } from '@/auth'; +import { handlers } from '@/auth'; export const { GET, POST } = handlers; -export { auth, signIn, signOut }; - export const runtime = "nodejs"; diff --git a/src/auth.ts b/src/auth.ts index 4822173..8c6597d 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -17,28 +17,23 @@ export const { handlers, auth, signIn, signOut } = NextAuth({ if (parsedCredentials.success) { const { email, password } = parsedCredentials.data; - try { - const userStmt = db.prepare('SELECT * FROM users WHERE email = ?'); - const user = userStmt.get(email) as any; + const userStmt = db.prepare('SELECT * FROM users WHERE email = ?'); + const user = userStmt.get(email) as any; - if (!user) return null; - - // WARNING: Storing passwords in plaintext is insecure. - // This is for demonstration purposes only. - // In a real application, you MUST hash and salt passwords. - const passwordsMatch = password === user.password; + if (!user) return null; + + // WARNING: Storing passwords in plaintext is insecure. + // This is for demonstration purposes only. + // In a real application, you MUST hash and salt passwords. + const passwordsMatch = password === user.password; - if (passwordsMatch) { - // The user object returned here will be encoded in the JWT. - return { id: user.id, name: user.name, email: user.email }; - } - - } catch (e) { - console.error(e) - return null + if (passwordsMatch) { + // The user object returned here will be encoded in the JWT. + return { id: user.id, name: user.name, email: user.email }; } } + console.log('Invalid credentials'); return null; }, }),