Skip to content

Commit

Permalink
removed password from user field
Browse files Browse the repository at this point in the history
  • Loading branch information
VenketeshRushi committed Nov 3, 2023
1 parent 6e3b83c commit 7381945
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
5 changes: 3 additions & 2 deletions module_auth/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ exports.login = async (req, res, next) => {
return res.status(401).json({ message: "Invalid Password" });
}

delete user.password

const token = jwt.sign({ user }, "1234");

return res.status(200).json({ user, token });
Expand Down Expand Up @@ -66,9 +68,8 @@ exports.signup = async (req, res, next) => {
data: { firstName, lastName, email, password: hashedPassword, isAdmin },
});

const token = jwt.sign({ user }, "your-secret-key");
return res.status(200).json({ message: "User signed up successfully" });

res.status(201).json({ user, token });
} catch (error) {
next(error);
}
Expand Down
13 changes: 6 additions & 7 deletions prisma/generated/client/edge.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7381945

Please sign in to comment.