Add check for JWT on login

This commit is contained in:
Alex Holliday committed 2024-08-09 13:19:05 -07:00
1 parent 5b2a05bc79
commit 9fe75c92dd
2 files changed
+5

No files matched your search

+4
View File
@@ -135,6 +135,10 @@ const loginController = async (req, res, next) => {
throw new Error(errorMessages.AUTH_INCORRECT_PASSWORD);
}
if (user.authToken) {
throw new Error(errorMessages.AUTH_ALREADY_LOGGED_IN);
}
// Remove password from user object. Should this be abstracted to DB layer?
const userWithoutPassword = { ...user._doc };
delete userWithoutPassword.password;