Discord account Linkage, penalty update
This commit is contained in:
@@ -3,6 +3,8 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { DiscordAccount, prisma } from "@repo/db";
|
||||
import { getServerSession } from "../auth/[...nextauth]/auth";
|
||||
import { setStandardName } from "../../../helper/discord";
|
||||
import { getUserPenaltys } from "@repo/shared-components";
|
||||
import { markDuplicate } from "(app)/admin/user/action";
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
const session = await getServerSession();
|
||||
@@ -77,6 +79,29 @@ export const GET = async (req: NextRequest) => {
|
||||
userId: user.id,
|
||||
});
|
||||
}
|
||||
const formerDiscordAccount = await prisma.formerDiscordAccount.findMany({
|
||||
where: {
|
||||
discordId: discordUser.id,
|
||||
userId: {
|
||||
not: session.user.id,
|
||||
},
|
||||
User: {
|
||||
canonicalUserId: null,
|
||||
},
|
||||
},
|
||||
include: { User: true },
|
||||
});
|
||||
|
||||
// Account is suspicious to multiaccounting
|
||||
if (formerDiscordAccount.length > 0) {
|
||||
formerDiscordAccount.forEach(async (account) => {
|
||||
await markDuplicate({
|
||||
duplicateUserId: session.user.id,
|
||||
canonicalPublicId: account.User!.publicId,
|
||||
reason: "Multiaccounting Verdacht, gleicher Discord Account wie ein anderer Nutzer.",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.redirect(`${process.env.NEXT_PUBLIC_HUB_URL}/settings`);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user