summaryrefslogtreecommitdiff
path: root/src/api/private
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-08 14:58:48 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-08 14:58:48 +0900
commit93c0af613f97cd70dddd454150d8174c1dee3577 (patch)
tree1a092b84fc4bb4070ea2dda552f15eba6340c3f8 /src/api/private
parentFix bugs (diff)
downloadsharkey-93c0af613f97cd70dddd454150d8174c1dee3577.tar.gz
sharkey-93c0af613f97cd70dddd454150d8174c1dee3577.tar.bz2
sharkey-93c0af613f97cd70dddd454150d8174c1dee3577.zip
Improve performance
Diffstat (limited to 'src/api/private')
-rw-r--r--src/api/private/signin.ts2
-rw-r--r--src/api/private/signup.ts4
2 files changed, 3 insertions, 3 deletions
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();