fix(hook): use beforeSave over beforeCreate
Changed the hook from `beforeCreate` to `beforeSave` With `beforeCreate` the password will not be hashed if it is changed later
This commit is contained in:
parent
0bfe865af4
commit
c19c0d0880
|
@ -13,7 +13,7 @@ class User extends Model {
|
||||||
* Look at `app/Models/Hooks/User.js` file to
|
* Look at `app/Models/Hooks/User.js` file to
|
||||||
* check the hashPassword method
|
* check the hashPassword method
|
||||||
*/
|
*/
|
||||||
this.addHook('beforeCreate', 'User.hashPassword')
|
this.addHook('beforeSave', 'User.hashPassword')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user