feat(hook): Verify status before hashing
To prevent double-hashing on udpate
This commit is contained in:
parent
4405040d99
commit
ba18e2d712
|
@ -12,7 +12,7 @@ class User extends Model {
|
|||
* it to the database.
|
||||
*/
|
||||
this.addHook('beforeCreate', async (userInstance) => {
|
||||
if (userInstance.password) {
|
||||
if (userInstance.dirty.password) {
|
||||
userInstance.password = await Hash.make(userInstance.password)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user