Integrate hugo static generator
This commit is contained in:
15
backend/miscellaneous/checkAuthenticated.ts
Normal file
15
backend/miscellaneous/checkAuthenticated.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { type NextFunction, type Request, type Response } from "express";
|
||||
import userModel, { values } from 'backend/models/userModel';
|
||||
|
||||
function checkAuthenticated(req: Request, res: Response, next: NextFunction) {
|
||||
const pass = req.body.pass;
|
||||
const password = userModel.getValue(values.pass);
|
||||
if (pass && password) {
|
||||
if (pass == password) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
return res.status(500).json({ message: 'Error when getting transactions.' });
|
||||
}
|
||||
|
||||
export default checkAuthenticated;
|
Reference in New Issue
Block a user