Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted Password Before Storing #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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