mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
minor
This commit is contained in:
parent
5200e218d1
commit
6aaa8fa94d
1 changed files with 2 additions and 3 deletions
|
@ -39,11 +39,10 @@ User.init({
|
|||
|
||||
User.prototype.comparePassword = async function (pwd) {
|
||||
if (!this.password) { return false }
|
||||
const ret = await bcrypt.compare(pwd, this.password)
|
||||
return ret
|
||||
return bcrypt.compare(pwd, this.password)
|
||||
}
|
||||
|
||||
User.beforeSave(async (user, options) => {
|
||||
User.beforeSave(async (user, _options) => {
|
||||
if (user.changed('password')) {
|
||||
const salt = await bcrypt.genSalt(10)
|
||||
const hash = await bcrypt.hash(user.password, salt)
|
||||
|
|
Loading…
Reference in a new issue