Skip to content

Conversation

@vishaltiwari012
Copy link

⚔️ Fixed issue #195

Successfully encrypted the password before storing in the database

Description
I implemented password encryption using a Mongoose pre save hook to automatically hash user passwords before saving them to the database. This ensures that passwords are securely stored without exposing them in plain text.

Reason for Changes:

  1. Ensure the secure storage of user passwords by hashing them before saving to the database.
  2. Centralize password encryption logic within the model using Mongoose's pre hook, following the DRY principle.
  3. Improve code maintainability and security by avoiding manual password hashing in the controller.

Test Plan:

  1. Register a new user and verify that the password is hashed in the database.
  2. Validate that incorrect passwords still render the appropriate error messages.
  3. Test user login functionality with the hashed password.

This PR fixes #195

Successfully encrypted the password before storing in the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Encrypt Passwords Before Storing Them

1 participant