summaryrefslogtreecommitdiff
path: root/src/api/private
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-01-18 14:19:50 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-01-18 14:19:50 +0900
commit1cd99290db41aa669de30877a685efdd8c298bd8 (patch)
tree1ae1dee774ed4318978d48bcc4e1f11507ece784 /src/api/private
parenttest (diff)
downloadsharkey-1cd99290db41aa669de30877a685efdd8c298bd8.tar.gz
sharkey-1cd99290db41aa669de30877a685efdd8c298bd8.tar.bz2
sharkey-1cd99290db41aa669de30877a685efdd8c298bd8.zip
bye bye bcrypt-nodejs
Closes #47
Diffstat (limited to 'src/api/private')
-rw-r--r--src/api/private/signin.ts4
-rw-r--r--src/api/private/signup.ts4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts
index 4d2cebac40..5af44ce940 100644
--- a/src/api/private/signin.ts
+++ b/src/api/private/signin.ts
@@ -1,5 +1,5 @@
import * as express from 'express';
-import * as bcrypt from 'bcrypt';
+import * as bcrypt from 'bcryptjs';
import User from '../models/user';
import Signin from '../models/signin';
import serialize from '../serializers/signin';
@@ -23,7 +23,7 @@ export default async (req: express.Request, res: express.Response) => {
}
// Compare password
- const same = await bcrypt.compare(password, user.password);
+ const same = bcrypt.compareSync(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 53d9e369ac..2b679b914c 100644
--- a/src/api/private/signup.ts
+++ b/src/api/private/signup.ts
@@ -1,5 +1,5 @@
import * as express from 'express';
-import * as bcrypt from 'bcrypt';
+import * as bcrypt from 'bcryptjs';
import rndstr from 'rndstr';
import recaptcha = require('recaptcha-promise');
import User from '../models/user';
@@ -54,7 +54,7 @@ export default async (req: express.Request, res: express.Response) => {
}
// Generate hash of password
- const salt = bcrypt.genSaltSync(14);
+ const salt = bcrypt.genSaltSync(8);
const hash = bcrypt.hashSync(password, salt);
// Generate secret