Hi i have a problem when i want to verify the hash password the response is always false and i cant loging i send to the console the plaintext, the hash password and use the verify function in the Hash library when i create the user the verify send true when i want to login the verify send false


Hey @eriasu !
May you copy/paste some code where you're using auth.attempt()?
@RomainLanz no problem
* doRegister(request, response){
const user = new User()
user.username = request.input('name')
user.email = request.input('email')
user.password = yield Hash.make(request.input('password'))
yield user.save()
yield response.sendView('register')
}
* login(request, response) {
const email = request.input('email')
const password = request.input('password')
const login = yield request.auth.attempt(email,password)
if(login){
response.send('Logged In')
return
}
response.unauthorized('Invalid Credentails')
}
Kind of weird. Mind creating a sample repo with the same code I can use to reproduce the issue?
Sorry for the delay https://github.com/eriasu/AdonisTest
i even test passing here the passwod for testing and making sure that the plaintext was compare with the hash but the same error =/ or maybe a made a huge mistake

You are hashing the password twice. Their is hook inside User model which hashes the password and you are doing it manually too inside the controller. Remove the controller one.
It needs to be
user.password = request.input('password')
yeah it was that stupid me srry for the trouble thanks for the help!
Closing the issue
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
You are hashing the password twice. Their is hook inside
Usermodel which hashes the password and you are doing it manually too inside the controller. Remove the controller one.It needs to be