Skip to content

BUG: FIx the Login Failure issue #315

@abhishekraoas

Description

@abhishekraoas

Here's a sample GitHub issue template for the login failure:


Bug Report: Login Failure Due to Password Comparison Issue

Issue Description

Users are unable to log in due to a password comparison failure in the handleUserLogin controller. Despite entering the correct credentials, login attempts are rejected with an "Invalid credentials" error.

Steps to Reproduce

  1. Sign up a new user account with a password.
  2. Attempt to log in using the correct email and password.

Expected Behavior

The login should succeed if the correct email and password are provided.

Actual Behavior

The login fails, returning an "Invalid credentials" error, even when the correct password is entered.

Possible Causes

  • Manual re-hashing of the password before comparison may be causing the mismatch.
  • There might be an issue with how bcrypt compares the plaintext password with the hashed password.

Suggested Solution

  • Ensure bcrypt.compare is used directly for comparing the plaintext password from the request with the hashed password stored in the database.
  • Double-check that the password is properly hashed and saved during the signup process.

Code Snippet (if applicable)

// Handle Login
const isMatch = await bcrypt.compare(password, userExist.password);
if (isMatch) {
  // proceed with login
} else {
  // handle failed login
}


This issue template should provide the development team with all the context needed to address the login failure problem effectively.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions