From dc084b78a875d0bcb875a856f5736fefb8046241 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 21 Feb 2025 17:47:59 -0800 Subject: [PATCH] Fixed user create. --- package.json | 2 +- src/app/api/users/route.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 275f1408..87076936 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "umami", - "version": "2.16.0", + "version": "2.16.1", "description": "A simple, fast, privacy-focused alternative to Google Analytics.", "author": "Umami Software, Inc. ", "license": "MIT", diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts index 320f72bd..f6b32fe7 100644 --- a/src/app/api/users/route.ts +++ b/src/app/api/users/route.ts @@ -10,7 +10,6 @@ export async function POST(request: Request) { const schema = z.object({ username: z.string().max(255), password: z.string(), - id: z.string().uuid(), role: z.string().regex(/admin|user|view-only/i), }); @@ -24,7 +23,7 @@ export async function POST(request: Request) { return unauthorized(); } - const { username, password, role, id } = body; + const { username, password, role } = body; const existingUser = await getUserByUsername(username, { showDeleted: true }); @@ -33,7 +32,7 @@ export async function POST(request: Request) { } const user = await createUser({ - id: id || uuid(), + id: uuid(), username, password: hashPassword(password), role: role ?? ROLES.user,