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.
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
// Discord on a member's account: link it to sign in with Discord too (and on T5DE's other sites), or unlink it.
|
|
import { DiscordButton } from "@/components/discord-button";
|
|
import { ActionForm, ErrorText, SubmitButton } from "@/components/forms";
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
import { unlinkDiscord } from "./actions";
|
|
|
|
export function DiscordCard({ linked, error }: { linked: boolean; error?: string }) {
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Discord</CardTitle>
|
|
<CardDescription>
|
|
{linked
|
|
? "Linked: you can sign in with Discord, here and on T5DE's other sites."
|
|
: "Link Discord to sign in with it, here and on T5DE's other sites."}
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="space-y-3">
|
|
{error && <ErrorText>{error}</ErrorText>}
|
|
{linked ? (
|
|
<ActionForm action={unlinkDiscord}>
|
|
<SubmitButton
|
|
variant="outline"
|
|
pendingLabel="Unlinking…"
|
|
confirm="Unlink Discord? You'll sign in with your username and password only."
|
|
>
|
|
Unlink Discord
|
|
</SubmitButton>
|
|
</ActionForm>
|
|
) : (
|
|
<DiscordButton mode="link" />
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|