Shortened code

master
Keith Irwin 2017-12-19 06:45:04 +00:00
parent 7d2faa09ab
commit 9acbb9f3fe
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 3 additions and 3 deletions

View File

@ -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)