;
+};
+
+export {
+ Root,
+ //
+ Root as Textarea,
+ type TextareaEvents,
+ type FormTextareaEvent
+};
diff --git a/src/lib/components/ui/textarea/textarea.svelte b/src/lib/components/ui/textarea/textarea.svelte
new file mode 100644
index 0000000..d8523ff
--- /dev/null
+++ b/src/lib/components/ui/textarea/textarea.svelte
@@ -0,0 +1,31 @@
+
+
+
diff --git a/src/routes/(auth)/login/(components)/user-auth-form.svelte b/src/routes/(auth)/login/(components)/user-auth-form.svelte
index 51e333d..973a7ad 100644
--- a/src/routes/(auth)/login/(components)/user-auth-form.svelte
+++ b/src/routes/(auth)/login/(components)/user-auth-form.svelte
@@ -1,53 +1,25 @@
-
+
+
+
+ Email
+
+
+
+
+
+
+ Password
+
+
+
+
+ Sign In
+
diff --git a/src/routes/(auth)/login/+page.server.ts b/src/routes/(auth)/login/+page.server.ts
new file mode 100644
index 0000000..be6ace8
--- /dev/null
+++ b/src/routes/(auth)/login/+page.server.ts
@@ -0,0 +1,58 @@
+import type { PageServerLoad, Actions } from './$types';
+import { fail } from '@sveltejs/kit';
+import { superValidate } from 'sveltekit-superforms/server';
+import { formSchema } from './schema';
+import { db } from '$lib/db';
+import { user as userSchema } from '$lib/db/schema';
+import { eq } from 'drizzle-orm';
+
+export const load = (async () => {
+ return {
+ form: superValidate(formSchema),
+ };
+}) satisfies PageServerLoad;
+
+export const actions: Actions = {
+ default: async (event) => {
+ const form = await superValidate(event, formSchema);
+
+ console.log(form);
+ if (!form.valid) {
+ return fail(400, {
+ form,
+ });
+ }
+
+ try {
+ const users = await db
+ .select()
+ .from(userSchema)
+ .where(eq(userSchema.email, form.data.email));
+
+ const user = users[0];
+ const matchPassword =
+ user && (await Bun.password.verify(form.data.password, user.password));
+
+ if (user && matchPassword) {
+ return {
+ form,
+ };
+ } else {
+ return fail(400, {
+ form,
+ });
+ }
+ } catch (error) {
+ if (error instanceof SyntaxError) {
+ return fail(400, {
+ form,
+ });
+ } else {
+ console.log(error);
+ return fail(400, {
+ form,
+ });
+ }
+ }
+ },
+};
diff --git a/src/routes/(auth)/login/+page.svelte b/src/routes/(auth)/login/+page.svelte
index 38333bd..922eb36 100644
--- a/src/routes/(auth)/login/+page.svelte
+++ b/src/routes/(auth)/login/+page.svelte
@@ -1,6 +1,9 @@
-
+
Don't Have An Account? Signup{' '}
)",
- input: "hsl(var(--input) / )",
- ring: "hsl(var(--ring) / )",
- background: "hsl(var(--background) / )",
- foreground: "hsl(var(--foreground) / )",
+ border: 'hsl(var(--border) / )',
+ input: 'hsl(var(--input) / )',
+ ring: 'hsl(var(--ring) / )',
+ background: 'hsl(var(--background) / )',
+ foreground: 'hsl(var(--foreground) / )',
primary: {
- DEFAULT: "hsl(var(--primary) / )",
- foreground: "hsl(var(--primary-foreground) / )"
+ DEFAULT: 'hsl(var(--primary) / )',
+ foreground: 'hsl(var(--primary-foreground) / )',
},
secondary: {
- DEFAULT: "hsl(var(--secondary) / )",
- foreground: "hsl(var(--secondary-foreground) / )"
+ DEFAULT: 'hsl(var(--secondary) / )',
+ foreground: 'hsl(var(--secondary-foreground) / )',
},
destructive: {
- DEFAULT: "hsl(var(--destructive) / )",
- foreground: "hsl(var(--destructive-foreground) / )"
+ DEFAULT: 'var(--destructive)',
+ foreground: 'hsl(var(--destructive-foreground) / )',
},
muted: {
- DEFAULT: "hsl(var(--muted) / )",
- foreground: "hsl(var(--muted-foreground) / )"
+ DEFAULT: 'hsl(var(--muted) / )',
+ foreground: 'hsl(var(--muted-foreground) / )',
},
accent: {
- DEFAULT: "hsl(var(--accent) / )",
- foreground: "hsl(var(--accent-foreground) / )"
+ DEFAULT: 'hsl(var(--accent) / )',
+ foreground: 'hsl(var(--accent-foreground) / )',
},
popover: {
- DEFAULT: "hsl(var(--popover) / )",
- foreground: "hsl(var(--popover-foreground) / )"
+ DEFAULT: 'hsl(var(--popover) / )',
+ foreground: 'hsl(var(--popover-foreground) / )',
},
card: {
- DEFAULT: "hsl(var(--card) / )",
- foreground: "hsl(var(--card-foreground) / )"
- }
+ DEFAULT: 'hsl(var(--card) / )',
+ foreground: 'hsl(var(--card-foreground) / )',
+ },
},
borderRadius: {
- lg: "var(--radius)",
- md: "calc(var(--radius) - 2px)",
- sm: "calc(var(--radius) - 4px)"
+ lg: 'var(--radius)',
+ md: 'calc(var(--radius) - 2px)',
+ sm: 'calc(var(--radius) - 4px)',
},
fontFamily: {
- sans: [...fontFamily.sans]
- }
- }
+ sans: [...fontFamily.sans],
+ },
+ },
},
};
diff --git a/tsconfig.json b/tsconfig.json
index 6ae0c8c..8d69530 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,7 +8,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
- "strict": true
+ "strict": true,
+ "types": ["bun-types"]
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//