From 0b065d4e252f5d05ce26553d226fe19a6fe46cd6 Mon Sep 17 00:00:00 2001 From: Leon Serfaty G Date: Mon, 1 Sep 2025 07:06:07 +0000 Subject: [PATCH] Error Something went wrong. --- local.db-shm | Bin 32768 -> 32768 bytes local.db-wal | Bin 135992 -> 181312 bytes src/app/api/auth/[...nextauth]/route.ts | 4 +--- src/auth.ts | 29 ++++++++++-------------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/local.db-shm b/local.db-shm index a588756130f790f007deb2cddf5b20b94f15781a..2de882f89436f22de0282158f6bfeafc259596d5 100644 GIT binary patch delta 195 zcmZo@U}|V!s+V}A%K!pAK+MR%AfN-J1%SBkc(nNRjjybv8`)g~KFYpYcj}-0rpaYcQ761TCG(3g? delta 183 zcmZo@U}|V!s+V}A%K!qLK+MR%AfO1O1%UWJi}xZKi|!R0vwjTTbcXzEZsTTVWYI57y|=?02DKW=*c-7jTyx@ zFW9(&pTqa;Y}YpB0+sCvMT`Oh{2>ze=G@SbUBCrY2h_A(-ieV@fa7bLf>w9jRk7_8 zCIJ<3*etzx@Zy^FVkoAAG=P90#Pm&{fQFx$$M;-RR6KR_h5(>8$Ktu$x1F7TfBOYN zkSX!c7i^v3yrF#ihf5%??)_^L`KJqcwi$tV(!c)Bu{C@qv|Zsdh$|j_ywB>@#_7uq Hf*1t=P&7_x delta 13 UcmX@m!M$S{M?(wa7A6Z}04L%EzyJUM 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; }, }),