minor
This commit is contained in:
@@ -39,11 +39,10 @@ User.init({
|
|||||||
|
|
||||||
User.prototype.comparePassword = async function (pwd) {
|
User.prototype.comparePassword = async function (pwd) {
|
||||||
if (!this.password) { return false }
|
if (!this.password) { return false }
|
||||||
const ret = await bcrypt.compare(pwd, this.password)
|
return bcrypt.compare(pwd, this.password)
|
||||||
return ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
User.beforeSave(async (user, options) => {
|
User.beforeSave(async (user, _options) => {
|
||||||
if (user.changed('password')) {
|
if (user.changed('password')) {
|
||||||
const salt = await bcrypt.genSalt(10)
|
const salt = await bcrypt.genSalt(10)
|
||||||
const hash = await bcrypt.hash(user.password, salt)
|
const hash = await bcrypt.hash(user.password, salt)
|
||||||
|
|||||||
Reference in New Issue
Block a user