This commit is contained in:
Nikola Petrov
2023-10-04 20:19:16 +02:00
parent ea623cedc8
commit 63346de8c1
12 changed files with 61 additions and 58 deletions

View File

@@ -2,7 +2,7 @@
var UserModel = require('../models/userModel');
async function checkAuthenticated(req, res, next) {
try{
try {
const password = req.body.pass;
const userFound = await UserModel.findOne({ pass: password });
if (!userFound) {
@@ -10,7 +10,7 @@ async function checkAuthenticated(req, res, next) {
}
req.user = userFound;
return next();
}catch (err) {
} catch (err) {
console.log(err);
return res.status(500).json({ message: 'Error when getting transactions.' });
}