mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
update cypress tests, update zod validation error messaging to UI
This commit is contained in:
parent
72ac97c5d9
commit
b1901c7278
18 changed files with 221 additions and 41 deletions
|
|
@ -1,9 +1,8 @@
|
|||
import { z } from 'zod';
|
||||
import { canUpdateUser, canViewUser, canDeleteUser } from '@/lib/auth';
|
||||
import { getUser, getUserByUsername, updateUser, deleteUser } from '@/queries';
|
||||
import { json, unauthorized, badRequest, ok } from '@/lib/response';
|
||||
import { hashPassword } from '@/lib/auth';
|
||||
import { canDeleteUser, canUpdateUser, canViewUser, hashPassword } from '@/lib/auth';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { badRequest, json, ok, unauthorized } from '@/lib/response';
|
||||
import { deleteUser, getUser, getUserByUsername, updateUser } from '@/queries';
|
||||
import { z } from 'zod';
|
||||
|
||||
export async function GET(request: Request, { params }: { params: Promise<{ userId: string }> }) {
|
||||
const { auth, error } = await parseRequest(request);
|
||||
|
|
@ -26,7 +25,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ user
|
|||
export async function POST(request: Request, { params }: { params: Promise<{ userId: string }> }) {
|
||||
const schema = z.object({
|
||||
username: z.string().max(255),
|
||||
password: z.string().max(255),
|
||||
password: z.string().max(255).optional(),
|
||||
role: z.string().regex(/admin|user|view-only/i),
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue