Implement SignIn/SignOut

This commit is contained in:
Jorge Vargas 2024-11-15 12:58:43 -06:00
parent bce35d73ca
commit adeb3fd3bf
16 changed files with 987 additions and 77 deletions

View file

@ -18,7 +18,10 @@ export default defineConfig({
async authorize(credentials) {
if (!credentials?.username || !credentials.password) throw new InvalidLoginError()
const user = await prismaClient.users.findUnique({ where: { username: credentials.username } })
const user = await prismaClient.users.findUnique({
select: { username: true, password: true },
where: { username: credentials.username }
})
if (!user) throw new InvalidLoginError()
const valid = await bcrypt.compare(credentials.password, user.password)