diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 2339ac8..013093a 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -9,6 +9,10 @@ const client = new ConvexHttpClient(process.env.PUBLIC_CONVEX_URL!); export const auth = betterAuth({ secret: process.env.BETTER_AUTH_SECRET!, database: convexAdapter(client), + emailAndPassword: { + enabled: true, + requireEmailVerification: false, + }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID!, diff --git a/src/lib/components/auth/email-auth-form.svelte b/src/lib/components/auth/email-auth-form.svelte new file mode 100644 index 0000000..3cbbe8f --- /dev/null +++ b/src/lib/components/auth/email-auth-form.svelte @@ -0,0 +1,125 @@ + + +
+
+ {#if mode === 'sign-up'} +
+ + +
+ {/if} + +
+ + +
+ +
+ + +
+ + {#if error} +
+ {error} +
+ {/if} + + + +
+ +
+
+
\ No newline at end of file diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index ef1a734..fe5306b 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -2,7 +2,11 @@ import { Button } from '$lib/components/ui/button'; import * as Icons from '$lib/components/icons'; import { authClient } from '$lib/backend/auth/client.js'; + import EmailAuthForm from '$lib/components/auth/email-auth-form.svelte'; import DeviconGoogle from '~icons/devicon/google'; + import MailIcon from '~icons/lucide/mail'; + + let showEmailForm = $state(false); async function signInGitHub() { await authClient.signIn.social({ provider: 'github', callbackURL: '/chat' }); @@ -13,12 +17,36 @@ } -
-

Sign in to thom.chat

- - +
+
+

Sign in to thom.chat

+

Choose your preferred sign-in method

+
+ + {#if !showEmailForm} +
+ + + +
+ {:else} + + + {/if}