0
Hello, I am developing an api on top of a legacy project used by other systems, and I intend to perform an authentication using md5 instead of bcrypt to compare the password only.
There is already a table of users with email and password (on md5).
In my controller everything is already working taking away the fact of await auth.attempt(usuario, senha)
compare password using bcrypt and not md5 as accurate.
I tried to install the md5 package and change the settings HASH_DRIVER
but unsuccessfully, the question is I don’t understand where I do this kind of configuration, and if it’s possible, I’ve searched the internet since yesterday and nothing yet, I’m waiting for a light where I should search.
I think this library can help you: https://www.npmjs.com/package/adonis-md5hash
– Bins
@Bins unfortunately it is outdated and I am not able to implement in version 4.1
– Lennon S. Bueno
You will probably have to recreate the method
attempt
manually, given that it is very unlikely that Adonis will ever provide you with this natively, since themd5
is not safe for that purpose.– Luiz Felipe
@Luizfelipe you could pass me the way to recreate the method Attempt ?
– Lennon S. Bueno
You will have to create the logic of
login
manually... Select the user table through the user name and then compare passwords.– Luiz Felipe
@Luizfelipe understand, is that with attemp I received the authentication token, I will see how to generate it
– Lennon S. Bueno
Just use the
auth.generate
after carrying out the checks.– Luiz Felipe
@Luizfelipe really I was going the wrong way, I performed a consultation manually and in the success generating the token, at first it is precise, grateful.
– Lennon S. Bueno