Fix bugs from refactor!

This commit is contained in:
2020-11-11 20:58:18 -06:00
parent 7002e78aa0
commit 0193935d2d
11 changed files with 132 additions and 139 deletions

View File

@@ -27,7 +27,7 @@ const register = async (req, res, next) => {
return next(error, null);
}
const token = jwt.sign(user, process.env.tokenSecret, {
const token = jwt.sign(users.convertToPublicFormat(user), process.env.tokenSecret, {
expiresIn: 604800 // 1 week
});
@@ -61,7 +61,7 @@ const login = async (req, res, next) => {
return res.status(401).send({ error: `Authentication failed. Wrong password.` });
}
const token = jwt.sign(user, process.env.tokenSecret, {
const token = jwt.sign(users.convertToPublicFormat(user), process.env.tokenSecret, {
expiresIn: 604800 // 1 week
});