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:
Stephen Afam-Osemene 2017-10-24 07:18:18 +01:00 committed by Harminder Virk
parent 0bfe865af4
commit c19c0d0880

View File

@ -13,7 +13,7 @@ class User extends Model {
* Look at `app/Models/Hooks/User.js` file to
* check the hashPassword method
*/
this.addHook('beforeCreate', 'User.hashPassword')
this.addHook('beforeSave', 'User.hashPassword')
}
/**