Mauricio Crispim
Mauricio Crispim

Reputation: 561

How to use "auth" with Adonis without a crypted password?

I using Adonis connect with a MSSQL DB who doesn't own a crypted password, but a i need to generate a token to reuse (because that i using Auth) but it does not work.

reading the documentation, i try to "Hash" that password and them auth, did not work. So i try, encrypt and them auth, nope again.

And finally i try to crypt, hash and them Auth... And them not work :|

Someone how get pass for this, can help me?

Upvotes: 1

Views: 677

Answers (1)

crbast
crbast

Reputation: 2302

I don't know if it's possible without encrypted password. Keeping passwords unencrypted is not a good idea.

You can encrypt all password with this code :

  const Hash = use("Hash");

  const users = await User.all();
  users.rows.forEach(async u => {
    u.password = await Hash.make(u.password);
    await u.save();
  });

!! Only run one time

Upvotes: 1

Related Questions