Improve performance
This commit is contained in:
@@ -40,7 +40,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
}
|
||||
|
||||
// Compare password
|
||||
const same = bcrypt.compareSync(password, user.password);
|
||||
const same = await bcrypt.compare(password, user.password);
|
||||
|
||||
if (same) {
|
||||
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
||||
|
@@ -54,8 +54,8 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
}
|
||||
|
||||
// Generate hash of password
|
||||
const salt = bcrypt.genSaltSync(8);
|
||||
const hash = bcrypt.hashSync(password, salt);
|
||||
const salt = await bcrypt.genSalt(8);
|
||||
const hash = await bcrypt.hash(password, salt);
|
||||
|
||||
// Generate secret
|
||||
const secret = generateUserToken();
|
||||
|
Reference in New Issue
Block a user