21 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| '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)
 | |
|   }
 | |
| }
 | 
