Don't hash user password once again on update
This commit is contained in:
parent
08535e56aa
commit
59557c4663
1 changed files with 7 additions and 4 deletions
|
@ -136,10 +136,13 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeCreateOrUpdate (user: UserInstance) {
|
function beforeCreateOrUpdate (user: UserInstance) {
|
||||||
return cryptPassword(user.password).then(hash => {
|
if (user.changed('password')) {
|
||||||
user.password = hash
|
return cryptPassword(user.password)
|
||||||
return undefined
|
.then(hash => {
|
||||||
})
|
user.password = hash
|
||||||
|
return undefined
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------ METHODS ------------------------------
|
// ------------------------------ METHODS ------------------------------
|
||||||
|
|
Loading…
Reference in a new issue