Skip to content

Commit

Permalink
🤬fix: prevent someone from changing the demo password
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinko committed Nov 16, 2024
1 parent 581cca8 commit 8b61f97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/routers/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { router, publicProcedure, authProcedure, superAdminAuthMiddleware } from '../trpc';
import { router, publicProcedure, authProcedure, superAdminAuthMiddleware, demoAuthMiddleware } from '../trpc';
import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { prisma } from '../prisma';
Expand Down Expand Up @@ -110,7 +110,7 @@ export const userRouter = router({
return false
}
}),
upsertUser: authProcedure
upsertUser: authProcedure.use(demoAuthMiddleware)
.meta({ openapi: { method: 'POST', path: '/v1/user/upsert', summary: 'Update or create user', tags: ['User'] } })
.input(z.object({
id: z.number().optional(),
Expand Down Expand Up @@ -151,7 +151,7 @@ export const userRouter = router({
}
})
}),
upsertUserByAdmin: authProcedure.use(superAdminAuthMiddleware)
upsertUserByAdmin: authProcedure.use(superAdminAuthMiddleware).use(demoAuthMiddleware)
.meta({ openapi: { method: 'POST', path: '/v1/user/upsert-by-admin', summary: 'Update or create user by admin', tags: ['User'] } })
.input(z.object({
id: z.number().optional(),
Expand Down

0 comments on commit 8b61f97

Please sign in to comment.