[dyad] Kayıt rolü uyumluluğunu güvenle koru
This commit is contained in:
1 parent
f88c294b45
commit
3a0e362d8c
1 file changed
+2
-4
@@ -24,7 +24,6 @@ const registerSchema = z.object({
|
|||||||
firstName: z.string().min(1),
|
firstName: z.string().min(1),
|
||||||
lastName: z.string().min(1),
|
lastName: z.string().min(1),
|
||||||
schoolId: z.string().optional(),
|
schoolId: z.string().optional(),
|
||||||
role: z.enum(['TEACHER', 'SCHOOL_ADMIN', 'SUPER_ADMIN', 'VICE_PRINCIPAL']).default('TEACHER'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const POST = withRateLimit(async function POST(request: Request) {
|
export const POST = withRateLimit(async function POST(request: Request) {
|
||||||
@@ -93,8 +92,7 @@ export const POST = withRateLimit(async function POST(request: Request) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { email, password, firstName, lastName, schoolId, role } =
|
const { email, password, firstName, lastName, schoolId } = parsed.data;
|
||||||
parsed.data;
|
|
||||||
|
|
||||||
const existing = await db.user.findUnique({ where: { email } });
|
const existing = await db.user.findUnique({ where: { email } });
|
||||||
if (existing) {
|
if (existing) {
|
||||||
@@ -113,7 +111,7 @@ export const POST = withRateLimit(async function POST(request: Request) {
|
|||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
schoolId: schoolId ?? null,
|
schoolId: schoolId ?? null,
|
||||||
role,
|
role: 'TEACHER',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user