From 4499e20e77fa87fb96fa7549d239c24b81e492b0 Mon Sep 17 00:00:00 2001 From: mifi Date: Tue, 9 May 2023 19:28:27 -0400 Subject: [PATCH 1/2] - Check that update route is authenticated --- lib/server/controllers/auth.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/server/controllers/auth.ts b/lib/server/controllers/auth.ts index 72ac52b..9048e6d 100644 --- a/lib/server/controllers/auth.ts +++ b/lib/server/controllers/auth.ts @@ -7,6 +7,7 @@ import Auth from '../../db/model/auth'; import { sign } from '../../utils/jwt'; import passport from '../passport'; import { ErrorCodes, getErrorBody } from '../../constants/errors'; +import { authenticated } from '../middleware/authenication'; const routerOpts: Router.IRouterOptions = { prefix }; const router: Router = new Router(routerOpts); @@ -43,7 +44,7 @@ router.post(process.env.RESET_ROUTE || RESET_ROUTE, async (ctx, next) => { ctx.body = { success: false, ...getErrorBody(ErrorCodes.RESET_REQUEST_DATA) }; }); -router.patch('/:record', (ctx: Koa.Context) => { +router.patch('/:record', authenticated(), (ctx: Koa.Context) => { const data = Auth.findOneAndUpdate({ record: ctx.params.record }); if (!data) { ctx.throw(StatusCodes.NOT_FOUND); From 4ed4b6e5f4388855d561c592031e489a4f303289 Mon Sep 17 00:00:00 2001 From: mifi Date: Tue, 9 May 2023 19:33:02 -0400 Subject: [PATCH 2/2] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9e3bb3..a1164fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mifi/auth", - "version": "0.0.35", + "version": "0.0.37", "author": "mifi (Mike Fitzpatrick)", "license": "MIT", "scripts": {