Login endpoint now returns the user profile.

This commit is contained in:
2022-04-06 22:53:20 -05:00
parent f98b003808
commit b575fc7fde
8 changed files with 51 additions and 30 deletions

View File

@@ -16,7 +16,8 @@ UserController.post("/login", needDatabase, async (req, res) => {
} else {
req.session.userId = user._id;
req.session.email = user.email;
res.status(200).send("Authenticated.");
user.password = undefined;
res.status(200).send(user);
}
} catch (error) {
if (error.name === "TypeError") {