admin cannot be a user

This commit is contained in:
Rajpreet0 2026-02-07 23:17:21 +01:00
parent 7f222baf5f
commit 4971988160
3 changed files with 13 additions and 5 deletions

View file

@ -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({

View file

@ -95,10 +95,7 @@ const ForgotPasswordView = () => {
<div className="flex flex-col sm:flex-row gap-2 items-center mt-8 text-sm">
<p>Zurück zum</p>
<p
className="text-yellow hover:underline cursor-pointer"
onClick={() => router.push("/login")}
>
<p className="text-blue underline cursor-pointer" onClick={() => router.push("/login")}>
Login
</p>
</div>

View file

@ -436,7 +436,7 @@ const CourseCreateView = ({
</Button>
</div>
<button
className="mt-6 w-fit cursor-pointer hover:underline disabled:opacity-50 disabled:cursor-not-allowed"
className="mt-6 mb-4 w-fit cursor-pointer hover:underline disabled:opacity-50 disabled:cursor-not-allowed"
onClick={() => handleSubmit("draft")}
disabled={isSubmitting}
>