juampi92/adonis-mongoose-model

Hash verify always returns false

jericopulvera opened this issue · 3 comments

My hooks on save

    this.addHook('preSave', async function() {
      this.password = await Hash.make(this.password)
    })
    const { email, password } = request.all()

    const user = await User.findOne({
      email: email,
      confirmed: true
    })

    const passwordIsCorrect = await Hash.verify(password, user.password)

    console.log(passwordIsCorrect)

what might be the reason for this?

Sorry I realized that I was hashing 2 times before saving.

Sorry I realized that I was hashing 2 times before saving.

Same happen to me

me too, doesnot work, forever false