From 9acbb9f3fe6614a58fe69dec8303b146f9e2590b Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Tue, 19 Dec 2017 06:45:04 +0000 Subject: [PATCH] Shortened code --- config/models.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/models.js b/config/models.js index 61dd392..bc00be0 100644 --- a/config/models.js +++ b/config/models.js @@ -187,7 +187,7 @@ userSchema.methods.generateHashedPassword = function (password, next) { if (err) return next(err) this.auth.password = hash this.save() - .then(next) + .then(() => { next(); }) .catch((err) => next(err) ) }) }) @@ -196,9 +196,9 @@ userSchema.methods.generateHashedPassword = function (password, next) { // Generate hash bcrypt.genSalt(8, (err, salt) => { - if (err) reject(err) + if (err) return reject(err) bcrypt.hash(password, salt, (err, hash) => { - if (err) reject(err) + if (err) return reject(err) this.auth.password = hash this.save() .then(resolve)