removed double login prevention

This commit is contained in:
Alex Holliday committed 2024-08-15 11:39:45 -07:00
1 parent 53ea08fc48
commit ae46527965
7 files changed
+26 -75

No files matched your search

-22
View File
@@ -136,10 +136,6 @@ 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;
@@ -164,23 +160,6 @@ const loginController = async (req, res, next) => {
}
};
const logoutController = async (req, res, next) => {
try {
// Get user
const { email } = req.body;
const userToLogout = await req.db.getUserByEmail(email);
userToLogout.authToken = null;
await userToLogout.save();
return res
.status(200)
.json({ success: true, msg: successMessages.AUTH_LOGOUT_USER });
} catch (error) {
error.service = SERVICE_NAME;
next(error);
}
};
const userEditController = async (req, res, next) => {
try {
await editUserParamValidation.validateAsync(req.params);
@@ -524,7 +503,6 @@ const getAllUsersController = async (req, res) => {
module.exports = {
registerController,
loginController,
logoutController,
userEditController,
inviteController,
inviteVerifyController,