Skip to content

Conversation

@Swapnxll
Copy link

This PR introduces the following changes to the user controller:

  1. Hashing: Police badgeNumber is now securely hashed using bcrypt.js during registration.
  2. Verification: badgeNumber is verified using bcrypt.compare() during login.

Fixes #30

Dependencies Added:

  1. bcryptjs
  2. jsonwebtoken

Why this is needed

  1. To secure police credentials (badgeNumber) instead of storing them in plaintext.
  2. To enable proper verification during login.

Setup:

npm install

Testing Steps

  1. Register a police user with name and badgeNumber.
  2. Attempt login with the same credentials.
  3. A JWT token should be returned only if the badge number matches (hashed and verified properly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: bcryptjs Not Used for Hashing in userController.js

2 participants