mirror of
https://github.com/Permissionless-Software-Foundation/bch-email-api.git
synced 2026-09-21 16:52:04 -07:00
Minor linting
This commit is contained in:
+15
-9
@@ -19,20 +19,24 @@ User.pre('save', function preSave (next) {
|
||||
|
||||
new Promise((resolve, reject) => {
|
||||
bcrypt.genSalt(10, (err, salt) => {
|
||||
if (err) { return reject(err) }
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
resolve(salt)
|
||||
})
|
||||
})
|
||||
.then(salt => {
|
||||
bcrypt.hash(user.password, salt, (err, hash) => {
|
||||
if (err) { throw new Error(err) }
|
||||
.then(salt => {
|
||||
bcrypt.hash(user.password, salt, (err, hash) => {
|
||||
if (err) {
|
||||
throw new Error(err)
|
||||
}
|
||||
|
||||
user.password = hash
|
||||
user.password = hash
|
||||
|
||||
next(null)
|
||||
next(null)
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(err => next(err))
|
||||
.catch(err => next(err))
|
||||
})
|
||||
|
||||
User.methods.validatePassword = function validatePassword (password) {
|
||||
@@ -40,7 +44,9 @@ User.methods.validatePassword = function validatePassword (password) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
bcrypt.compare(password, user.password, (err, isMatch) => {
|
||||
if (err) { return reject(err) }
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
|
||||
resolve(isMatch)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user