feat(*) initial commit
This commit is contained in:
20
app/Models/Hooks/User.js
Normal file
20
app/Models/Hooks/User.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict'
|
||||
|
||||
const Hash = use('Hash')
|
||||
|
||||
const UserHook = module.exports = {}
|
||||
|
||||
/**
|
||||
* Hash using password as a hook.
|
||||
*
|
||||
* @method
|
||||
*
|
||||
* @param {Object} userInstance
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
UserHook.hashPassword = async (userInstance) => {
|
||||
if (userInstance.password) {
|
||||
userInstance.password = await Hash.make(userInstance.password)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user