🐛 (user) fix user check password
This commit is contained in:
13
src/helpers/security/password/compare.ts
Normal file
13
src/helpers/security/password/compare.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { AppError } from "../../error/instances/app";
|
||||
import bcrypt from "bcrypt";
|
||||
|
||||
export const comparePassword = async (
|
||||
passwordInput: string,
|
||||
passwordRaw: string
|
||||
) => {
|
||||
try {
|
||||
return bcrypt.compare(passwordInput, passwordRaw);
|
||||
} catch (error) {
|
||||
throw new AppError(401, "Invalid credentials", error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user