From 4971988160929764d870505043326af6d6cb8413 Mon Sep 17 00:00:00 2001 From: Rajpreet0 Date: Sat, 7 Feb 2026 23:17:21 +0100 Subject: [PATCH] admin cannot be a user --- src/app/api/auth/register/route.ts | 11 +++++++++++ src/modules/auth/ui/views/forgot-password-view.tsx | 5 +---- src/modules/courses/ui/views/course-create-view.tsx | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/api/auth/register/route.ts b/src/app/api/auth/register/route.ts index 1b96dce..edfae97 100644 --- a/src/app/api/auth/register/route.ts +++ b/src/app/api/auth/register/route.ts @@ -12,6 +12,17 @@ export async function POST(request: Request) { return NextResponse.json({ error: "Pflichtfelder fehlen" }, { status: 400 }); } + const existingManager = await prisma.manager.findUnique({ + where: { email }, + }); + + if (existingManager) { + return NextResponse.json( + { error: "Ein Manager kann nicht gleichzeitig ein User sein" }, + { status: 409 } + ); + } + const supabase = await createClient(); const { data, error } = await supabase.auth.signUp({ diff --git a/src/modules/auth/ui/views/forgot-password-view.tsx b/src/modules/auth/ui/views/forgot-password-view.tsx index 5458145..632114e 100644 --- a/src/modules/auth/ui/views/forgot-password-view.tsx +++ b/src/modules/auth/ui/views/forgot-password-view.tsx @@ -95,10 +95,7 @@ const ForgotPasswordView = () => {

Zurück zum

-

router.push("/login")} - > +

router.push("/login")}> Login

diff --git a/src/modules/courses/ui/views/course-create-view.tsx b/src/modules/courses/ui/views/course-create-view.tsx index c59c99b..65aebac 100644 --- a/src/modules/courses/ui/views/course-create-view.tsx +++ b/src/modules/courses/ui/views/course-create-view.tsx @@ -436,7 +436,7 @@ const CourseCreateView = ({