Step 1

Let's create a few sample users with simple usernames and passwords!

Update the scripts/sampleUsers.js file:

- const faker = require("faker");
  const db = require("../server/data/db");
  const UserDao = require("../server/data/UserDao");

- async function createSampleUsers(role) {
+ async function createSampleUsers(username, role) {
    try {
      await db.connect();

      const users = new UserDao();
      const user = await users.create({
-       username: faker.internet.userName(),
+       username: username,
-       password: faker.internet.password(),
+       password: username,
        role: role,
      });
      console.log(user);
    } catch (err) {
      console.log(err);
    }
  }

- createSampleUsers("CLIENT");
- createSampleUsers("CLIENT");
- createSampleUsers("ADMIN");
+ createSampleUsers("client1", "CLIENT");
+ createSampleUsers("client2", "CLIENT");
+ createSampleUsers("admin1", "ADMIN");
+ createSampleUsers("admin2", "ADMIN");

Save the changes. Then, run the script:

node scripts/sampleUsers.js

Try to authenticate a sample user!