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.
16 lines
1016 B
TypeScript
16 lines
1016 B
TypeScript
// What went wrong with Discord sign-in or linking, as a sentence. Better Auth sends people back with ?error=<code>.
|
|
const messages: Record<string, string> = {
|
|
email_not_verified: "Your Discord account's email isn't verified. Verify it in Discord, then try again.",
|
|
email_not_found: "Your Discord account has no email. Add one in Discord and verify it, then try again.",
|
|
account_not_linked:
|
|
"This email belongs to a T5DE account. Sign in to it with your username and password, then link Discord from your account page.",
|
|
account_already_linked_to_different_user: "That Discord account already signs in to another T5DE account.",
|
|
access_denied: "Discord sign-in was cancelled.",
|
|
};
|
|
|
|
/** The sentence for an error Discord sign-in came back with (undefined if there's none). */
|
|
export function discordError(code: string | string[] | undefined): string | undefined {
|
|
if (typeof code !== "string" || !code) return undefined;
|
|
return messages[code] ?? "Signing in with Discord didn't work. Try again.";
|
|
}
|