parent
4059e3b504
commit
1cd99290db
3 changed files with 6 additions and 6 deletions
|
@ -21,7 +21,7 @@
|
||||||
"test": "mocha --harmony"
|
"test": "mocha --harmony"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/bcrypt": "1.0.0",
|
"@types/bcryptjs": "2.4.0",
|
||||||
"@types/body-parser": "0.0.33",
|
"@types/body-parser": "0.0.33",
|
||||||
"@types/browserify": "12.0.30",
|
"@types/browserify": "12.0.30",
|
||||||
"@types/chai": "3.4.34",
|
"@types/chai": "3.4.34",
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
"babel-polyfill": "6.20.0",
|
"babel-polyfill": "6.20.0",
|
||||||
"babel-preset-es2015": "6.18.0",
|
"babel-preset-es2015": "6.18.0",
|
||||||
"babel-preset-stage-3": "6.17.0",
|
"babel-preset-stage-3": "6.17.0",
|
||||||
"bcrypt": "1.0.2",
|
"bcryptjs": "2.4.0",
|
||||||
"body-parser": "1.15.2",
|
"body-parser": "1.15.2",
|
||||||
"browserify": "13.3.0",
|
"browserify": "13.3.0",
|
||||||
"browserify-livescript": "0.2.3",
|
"browserify-livescript": "0.2.3",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as bcrypt from 'bcrypt';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
import Signin from '../models/signin';
|
import Signin from '../models/signin';
|
||||||
import serialize from '../serializers/signin';
|
import serialize from '../serializers/signin';
|
||||||
|
@ -23,7 +23,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare password
|
// Compare password
|
||||||
const same = await bcrypt.compare(password, user.password);
|
const same = bcrypt.compareSync(password, user.password);
|
||||||
|
|
||||||
if (same) {
|
if (same) {
|
||||||
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
import * as bcrypt from 'bcrypt';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import rndstr from 'rndstr';
|
import rndstr from 'rndstr';
|
||||||
import recaptcha = require('recaptcha-promise');
|
import recaptcha = require('recaptcha-promise');
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
|
@ -54,7 +54,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate hash of password
|
// Generate hash of password
|
||||||
const salt = bcrypt.genSaltSync(14);
|
const salt = bcrypt.genSaltSync(8);
|
||||||
const hash = bcrypt.hashSync(password, salt);
|
const hash = bcrypt.hashSync(password, salt);
|
||||||
|
|
||||||
// Generate secret
|
// Generate secret
|
||||||
|
|
Loading…
Reference in a new issue