From ffd8bd2e31ab2ee25628ca1e8ed5841fc296d4ad Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:08:05 -0700 Subject: [PATCH] added registration-check for old accounts --- apps/hub/app/(auth)/register/action.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/hub/app/(auth)/register/action.ts b/apps/hub/app/(auth)/register/action.ts index 31c4fba8..a15bf2df 100644 --- a/apps/hub/app/(auth)/register/action.ts +++ b/apps/hub/app/(auth)/register/action.ts @@ -1,6 +1,8 @@ "use server"; import { prisma, Prisma } from "@repo/db"; import bcrypt from "bcryptjs"; +import OLD_USER from "../../api/auth/[...nextauth]/var.User.json"; +import { OldUser } from "../../../types/oldUser"; export const register = async ({ password, ...user }: Omit) => { const hashedPassword = await bcrypt.hash(password, 12); @@ -26,12 +28,22 @@ export const register = async ({ password, ...user }: Omit u.email === user.email); + if (existingUser) { return { error: "Ein Nutzer mit dieser E-Mail-Adresse existiert bereits.", }; } + if (existingOldUser) { + return { + error: + "Diese Email existriert bereits in der alten Version von VAR. Bitte melde dich an oder ändere dein Passwort.", + }; + } + const newUser = prisma.user.create({ data: { ...user,