From 0b79d48d210d0cdb7017a6723a64142c65ef44c1 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Sun, 10 Jun 2018 22:33:30 +0200 Subject: [PATCH] fix(User): use beforeSave hook --- app/Models/User.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/User.js b/app/Models/User.js index 1740431..b046866 100644 --- a/app/Models/User.js +++ b/app/Models/User.js @@ -11,7 +11,7 @@ class User extends Model { * A hook to hash the user password before saving * it to the database. */ - this.addHook('beforeCreate', async (userInstance) => { + this.addHook('beforeSave', async (userInstance) => { if (userInstance.dirty.password) { userInstance.password = await Hash.make(userInstance.password) }