Skip to content

Commit

Permalink
Merge branch 'hotfix-0.2.48'
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Jul 12, 2023
2 parents 9797bdb + a2c733d commit 0c0931e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tdm-calculator-client",
"version": "0.2.47",
"version": "0.2.48",
"private": true,
"proxy": "http://localhost:5001",
"scripts": {
Expand Down
Binary file added client/public/IDORAtttack.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "0.2.47",
"version": "0.2.48",
"private": true,
"scripts": {
"release-notes": "gren release --override",
Expand Down
27 changes: 17 additions & 10 deletions server/app/controllers/account.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ const getAll = async (req, res) => {
}
};

const getById = async (req, res) => {
try {
const { id } = req.params;
const response = await accountService.selectById(id);
res.send(response);
} catch (err) {
res.status("500").json({ error: err.toString() });
}
};
// const getById = async (req, res) => {
// try {
// const { id } = Number(req.params);
// const user = req.user;
// // Only allow if request is for account info of current user
// // or current user is Admin or SecurityAdmin
// if (id !== user.id && !user.isAdmin && !user.isSecurityAdmin) {
// res.sendStatus("401");
// } else {
// const response = await accountService.selectById(id);
// res.send(response);
// }
// } catch (err) {
// res.status("500").json({ error: err.toString() });
// }
// };

const getByEmail = async (req, res) => {
try {
Expand Down Expand Up @@ -147,7 +154,7 @@ const remove = async (req, res) => {

module.exports = {
getAll,
getById,
// getById,
getByEmail,
register: [
validate({ body: accountRegisterSchema }),
Expand Down
2 changes: 1 addition & 1 deletion server/app/routes/account.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const router = require("express").Router();
const accountController = require("../controllers/account.controller");
const jwtSession = require("../../middleware/jwt-session");

router.get("/:id", jwtSession.validateUser, accountController.getById);
// router.get("/:id", jwtSession.validateUser, accountController.getById);
router.get(
"/",
jwtSession.validateRoles(["isSecurityAdmin"]),
Expand Down
32 changes: 16 additions & 16 deletions server/app/services/account.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ const selectAll = async () => {
}
};

const selectById = async id => {
try {
await poolConnect;
const request = pool.request();
request.input("Id", mssql.Int, id);

const response = await request.execute("Login_SelectById");
if (response.recordset && response.recordset.length > 0) {
return response.recordset[0];
}
return null;
} catch (err) {
return Promise.reject(err);
}
};
// const selectById = async id => {
// try {
// await poolConnect;
// const request = pool.request();
// request.input("Id", mssql.Int, id);

// const response = await request.execute("Login_SelectById");
// if (response.recordset && response.recordset.length > 0) {
// return response.recordset[0];
// }
// return null;
// } catch (err) {
// return Promise.reject(err);
// }
// };

const selectByEmail = async email => {
try {
Expand Down Expand Up @@ -412,7 +412,7 @@ async function hashPassword(user) {

module.exports = {
selectAll,
selectById,
// selectById,
register,
updateAccount,
confirmRegistration,
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tdm-calculator-api",
"version": "0.2.47",
"version": "0.2.48",
"description": "Traffic Data Management Calculator",
"repository": {
"type": "git",
Expand Down

0 comments on commit 0c0931e

Please sign in to comment.