Remove Discord and Google OAuth verification from CMS
- Remove Discord + Google OAuth providers from NextAuth config - Remove social login buttons (Discord/Google) from login form - Delete link-discord.ts action and discord-verify-form.tsx component - Simplify verify page to email-only verification flow - Remove connections settings page and its link from settings - Clean env.ts, .env, .env.example of Discord/Google client vars - Remove discordUrl social icon from register, login, and homepage - Clean translation files: remove continueWithDiscord, continueWithGoogle, connections keys
This commit is contained in:
1 parent
f7f6e09174
commit
7f8d083763
36 files changed
+34
-994
No files matched your search
@@ -1,14 +1,12 @@
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { isValidVerificationToken } from "@/actions/email-verify";
|
||||
import { DiscordVerifyForm } from "@/components/auth/discord-verify-form";
|
||||
import { ContentCard, EmptyState } from "@/components/public/ui";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
type Status = "verified" | "already" | "invalid" | "unavailable" | "discord";
|
||||
type Status = "verified" | "already" | "invalid" | "unavailable";
|
||||
|
||||
export default async function VerifyPage({
|
||||
searchParams,
|
||||
@@ -16,36 +14,15 @@ export default async function VerifyPage({
|
||||
searchParams: Promise<{
|
||||
token?: string;
|
||||
email?: string;
|
||||
method?: string;
|
||||
linked?: string;
|
||||
}>;
|
||||
}) {
|
||||
const t = await getTranslations("pages.verify");
|
||||
const {
|
||||
token = "",
|
||||
email = "",
|
||||
method = "",
|
||||
linked = "",
|
||||
} = await searchParams;
|
||||
const { token = "", email = "" } = await searchParams;
|
||||
const normalisedEmail = email.trim().toLowerCase();
|
||||
|
||||
let status: Status = "invalid";
|
||||
let discordAlreadyLinked = false;
|
||||
|
||||
if (method === "discord" || linked === "1") {
|
||||
status = "discord";
|
||||
const session = await auth();
|
||||
if (session?.user?.id) {
|
||||
const userId = Number(session.user.id);
|
||||
try {
|
||||
const linkedRow = await prisma.socialAccounts.findFirst({
|
||||
where: { userId: BigInt(userId), provider: "discord" },
|
||||
select: { id: true },
|
||||
});
|
||||
discordAlreadyLinked = !!linkedRow;
|
||||
} catch {}
|
||||
}
|
||||
} else if (normalisedEmail && token) {
|
||||
if (normalisedEmail && token) {
|
||||
const ok = await isValidVerificationToken(normalisedEmail, token);
|
||||
if (ok) {
|
||||
try {
|
||||
@@ -128,44 +105,6 @@ export default async function VerifyPage({
|
||||
</div>
|
||||
</ContentCard>
|
||||
)}
|
||||
|
||||
{status === "discord" && (
|
||||
<ContentCard
|
||||
icon="🎮"
|
||||
title="Verifieer via Discord"
|
||||
subtitle="Koppel je Discord account"
|
||||
>
|
||||
{linked === "1" && (
|
||||
<div
|
||||
className="rounded-md p-4 text-center mb-4"
|
||||
style={{ backgroundColor: "#14532d", color: "white" }}
|
||||
>
|
||||
<p className="text-lg font-bold mb-1">Gelinkt!</p>
|
||||
<p className="text-sm opacity-90">
|
||||
Je Discord account is gekoppeld. Je kunt nu verder.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{discordAlreadyLinked ? (
|
||||
<div
|
||||
className="rounded-md p-4 text-center"
|
||||
style={{ backgroundColor: "#14532d", color: "white" }}
|
||||
>
|
||||
<p className="text-lg font-bold mb-1">Al geverifieerd!</p>
|
||||
<p className="text-sm opacity-90">
|
||||
Je Discord account is al gekoppeld aan dit account.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<DiscordVerifyForm />
|
||||
)}
|
||||
<div style={{ textAlign: "center", marginTop: "1rem" }}>
|
||||
<Link href="/" className="btn btn-primary">
|
||||
Naar home
|
||||
</Link>
|
||||
</div>
|
||||
</ContentCard>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user