Discord sign-in and basic accounts
Discord sign-in makes a basic account (Discord's verified email, no username or password) for T5DE's other sites; it finishes setting up with a username and password to use the hub. Implicit linking by email is off; members link Discord from their account page. Better Auth 1.7.26.
This commit is contained in:
1 parent
a66a3a4b6a
commit
f0a9661f8e
24 files changed
+5214
-173
No files matched your search
@@ -1,18 +1,42 @@
|
||||
import type { Metadata } from "next";
|
||||
import { redirect } from "next/navigation";
|
||||
import { DiscordButton } from "@/components/discord-button";
|
||||
import { ErrorText } from "@/components/forms";
|
||||
import { NarrowCard } from "@/components/narrow-card";
|
||||
import { getMe } from "@/lib/api";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { api, getMe, unwrap } from "@/lib/api";
|
||||
import { discordError } from "@/lib/discord";
|
||||
import { safeNext } from "@/lib/paths";
|
||||
import { SignInForm } from "./signin-form";
|
||||
|
||||
export const metadata: Metadata = { title: "Sign in" };
|
||||
|
||||
export default async function SignIn({ searchParams }: { searchParams: Promise<{ next?: string | string[] }> }) {
|
||||
const next = safeNext((await searchParams).next);
|
||||
export default async function SignIn({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ next?: string | string[]; error?: string | string[] }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const next = safeNext(params.next);
|
||||
if (await getMe()) redirect(next);
|
||||
const { discord } = unwrap(await api.hub.get());
|
||||
const error = discordError(params.error);
|
||||
return (
|
||||
<NarrowCard title="Sign in" description="to your T5DE account.">
|
||||
<SignInForm next={next} />
|
||||
<div className="space-y-6">
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
{discord && (
|
||||
<>
|
||||
<DiscordButton mode="sign-in" next={next} />
|
||||
<div className="flex items-center gap-3 text-xs text-muted-foreground">
|
||||
<Separator className="flex-1" />
|
||||
or with your username
|
||||
<Separator className="flex-1" />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<SignInForm next={next} />
|
||||
</div>
|
||||
</NarrowCard>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user