Sunday, 9 April 2017

How to seed MongoDb with username/password data?

I created an app using MongoDB, NodeJS, Express.

I am using passport.js (local strategy) for user authentication. Thus my users collection has: * username * password * Salt * Hash

Basically I created a web app and I'm trying to create 100 fake users just to populate the site (testing purposes).

After some initial research, I decided that creating JSON data then using MongoDB import would be the best approach (what do you think?)

My question is: -- What is the best way to create a random username, password, salt, hash?

I was looking at this, but it doesn't have Hash https://www.npmjs.com/package/random-user

Then https://www.npmjs.com/package/password-hash But I can't get salt...

What would you do?



via Asool

No comments:

Post a Comment