Skip to content

Commit

Permalink
Fix bug in /editUser where password was being rehashed
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshGajabi committed Dec 11, 2023
1 parent 81fc501 commit cecc937
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ module.exports.edit = async (req, res, next) => {
if (!user.isAdmin && email !== user.email) {
throw new Error('Email does not match user!');
}

user.password = password || user.password;
if (password) user.password = password;
user.firstName = firstName || user.firstName;
user.lastName = lastName || user.lastName;
user.contactNumber = contactNumber || user.contactNumber;
Expand Down

0 comments on commit cecc937

Please sign in to comment.