Skip to content

Commit

Permalink
Merge pull request #76 from fdhhhdjd/release-#6
Browse files Browse the repository at this point in the history
#67 Fix bug Forget Password
  • Loading branch information
fdhhhdjd committed Oct 15, 2022
2 parents 0eeb8a1 + e6bb4ae commit 78bbd28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const NewAcceptToken = (user) => {
return HELPER.createAccessToken(user);
};
//** Update Password */
const UpdatePassword = async (user_id, password) => {
const UpdatePassword = async ({ user_id, password }) => {
console.log(user_id, password);
return Users.findByIdAndUpdate(
{ _id: user_id },
{ password: password },
Expand Down
6 changes: 4 additions & 2 deletions backend/src/v1/user_api/services/user.service/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,12 @@ module.exports = {
element,
};
}
let user = element;
const salt = await PASSWORD.genSalt();
const passwordHash = await PASSWORD.encodeResetPassword(password, salt);
await UpdatePassword(user.id, passwordHash);
await UpdatePassword({
user_id: user_id,
password: passwordHash,
});
return {
status: 200,
success: true,
Expand Down

0 comments on commit 78bbd28

Please sign in to comment.