Hi everybody I try use hash in password model but if i try save a new user adonis send me this error :
Error: Cannot find module 'phc-argon2'
I find in official documentation of adonis but i not found some solution...
this is my model :
import { DateTime } from 'luxon'
import { BaseModel, column, beforeSave, hasOne, HasOne } from '@ioc:Adonis/Lucid/Orm'
import Hash from '@ioc:Adonis/Core/Hash'
import Profile from 'App/Models/Profile'
import Myvericode from 'App/Models/Myvericode'
export default class User extends BaseModel {
@column({ isPrimary: true })
public id: number
@column.dateTime({ autoCreate: true })
public createdAt: DateTime
@column.dateTime({ autoCreate: true, autoUpdate: true })
public updatedAt: DateTime
@column()
public name : string
@column()
public username : string
@column({ serializeAs: null })
public password : string
@column()
public phonenumber:string
@column()
public email : string
@column()
public isverifiedemail : number
@hasOne(() => Profile)
public profile: HasOne<typeof Profile>
@hasOne(() => Myvericode)
public vericode: HasOne<typeof Myvericode>
@beforeSave()
public static async hashPassword (user: User) {
if (user.$dirty.password) {
user.password = await Hash.hash(user.password)
}
}
}
package.json
– Koenraad