Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (user.validPassword(req.body.password)) {
- console.log("two");
- }
- else {
- console.log("three");
- }
- And here is user.js code
- UserSchema.methods.validPassword = function(pass) {
- this.salt = crypto.randomBytes(16).toString('hex');
- var hash = crypto.pbkdf2Sync(pass, this.salt, 1000, 64, `sha512`).toString(`hex`);
- console.log(hash);
- return this.hash === hash;
- };
Add Comment
Please, Sign In to add comment