adonis-fullstack-app/app/Models/Hooks/User.js

21 lines
345 B
JavaScript
Raw Normal View History

2017-08-20 17:09:25 +00:00
'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)
}
}