mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed a bit
This commit is contained in:
1 parent
25fe268ed6
commit
c62413eafa
4 files changed
+60
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { queryOne } from "@/lib/db";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
export async function validateCredentials(username, password) {
|
||||
const user = await queryOne("SELECT * FROM users WHERE username = ?", [
|
||||
username,
|
||||
]);
|
||||
|
||||
if (user && bcrypt.compareSync(password, user.password)) {
|
||||
return {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
teamId: user.team_id,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user