From 93c0af613f97cd70dddd454150d8174c1dee3577 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 8 Nov 2017 14:58:48 +0900 Subject: Improve performance --- src/api/private/signin.ts | 2 +- src/api/private/signup.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/api/private') diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts index c7dc243980..0689887925 100644 --- a/src/api/private/signin.ts +++ b/src/api/private/signin.ts @@ -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 diff --git a/src/api/private/signup.ts b/src/api/private/signup.ts index bcc17a876d..7a6b9c098e 100644 --- a/src/api/private/signup.ts +++ b/src/api/private/signup.ts @@ -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(); -- cgit v1.2.3-freya