refactor(auth): added in correct bycrptjs
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import bcrypt from "bcrypt";
|
||||
import bcrypt from "bcryptjs";
|
||||
export const checkPassword = async (
|
||||
currentPassword: string,
|
||||
dbPassword: string
|
||||
) => {
|
||||
let decyptPass = "";
|
||||
try {
|
||||
decyptPass = atob(dbPassword);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
// encypt password
|
||||
const pass: string | undefined = process.env.SECRET;
|
||||
|
||||
export const checkPassword = async (currentPassword: string, dbPassword: string) => {
|
||||
let decyptPass = "";
|
||||
try {
|
||||
decyptPass = atob(dbPassword);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
// encypt password
|
||||
const pass: string | undefined = process.env.SECRET;
|
||||
const checked = bcrypt.compareSync(pass + currentPassword, decyptPass);
|
||||
|
||||
const checked = bcrypt.compareSync(pass + currentPassword, decyptPass);
|
||||
|
||||
return checked;
|
||||
return checked;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user