Skip to content

Conversation

@SaiPavithra26
Copy link
Contributor

Added Authentication with Bcrypt

Updated server/server.js:

  • Implemented user authentication with bcrypt for password hashing.

  • New users are registered with hashed passwords stored in the database (User model).

  • Existing users can log in; passwords are verified against the bcrypt hash.

  • Wrong password attempts send "ERROR: Wrong password" to the client and disconnect them.

  • Users are marked online when connected and offline when disconnected.

  • All user connections are logged in the database with connectedAt timestamp.

  • Updated server/models/User.js:

    • Added passwordHash field to store bcrypt-hashed passwords.
  • server/models/Message.js:

    • Ensured chat messages are only stored if content is not empty to prevent validation errors.

    Demo Video

Screen.Recording.2026-01-15.004837.mp4

Screenshot

image

@OpenGitBot
Copy link

Hey @SaiPavithra26

PR Template is not followed. Kindly follow the template & edit it again for consideration as a valid pull request.

Thanks for contributing in OpenCode'25 ✨✨!

Correct Tempelate:
Issue : #<Issue_Number>

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.

2 participants