diff --git a/www/app/favicon.ico b/www/app/favicon.ico deleted file mode 100644 index 718d6fe..0000000 Binary files a/www/app/favicon.ico and /dev/null differ diff --git a/www/app/globals.css b/www/app/globals.css index f6aa6c3..5203499 100644 --- a/www/app/globals.css +++ b/www/app/globals.css @@ -25,3 +25,7 @@ @apply border-foreground/20; } } + +body { + background-color: white; +} diff --git a/www/app/login/page.tsx b/www/app/login/page.tsx index 37fc75d..a01e63a 100644 --- a/www/app/login/page.tsx +++ b/www/app/login/page.tsx @@ -1,119 +1,11 @@ -import Link from "next/link"; -import { headers } from "next/headers"; -import { createClient } from "@/utils/supabase/server"; -import { redirect } from "next/navigation"; -import { SubmitButton } from "./submit-button"; +function loginPage() { -export default function Login({ - searchParams, -}: { - searchParams: { message: string }; -}) { - const signIn = async (formData: FormData) => { - "use server"; + return ( - const email = formData.get("email") as string; - const password = formData.get("password") as string; - const supabase = createClient(); +
- const { error } = await supabase.auth.signInWithPassword({ - email, - password, - }); - - if (error) { - return redirect("/login?message=Could not authenticate user"); - } - - return redirect("/protected"); - }; - - const signUp = async (formData: FormData) => { - "use server"; - - const origin = headers().get("origin"); - const email = formData.get("email") as string; - const password = formData.get("password") as string; - const supabase = createClient(); - - const { error } = await supabase.auth.signUp({ - email, - password, - options: { - emailRedirectTo: `${origin}/auth/callback`, - }, - }); - - if (error) { - return redirect("/login?message=Could not authenticate user"); - } - - return redirect("/login?message=Check email to continue sign in process"); - }; - - return ( -
- - - - {" "} - Back - - -
- - - - - - Sign In - - - Sign Up - - {searchParams?.message && ( -

- {searchParams.message} -

- )} -
- ); + ) } + +export default loginPage; \ No newline at end of file diff --git a/www/app/signin/page.tsx b/www/app/signin/page.tsx new file mode 100644 index 0000000..3263a42 --- /dev/null +++ b/www/app/signin/page.tsx @@ -0,0 +1,78 @@ +"use client" + +import { zodResolver } from "@hookform/resolvers/zod" +import {FieldValues, useForm} from 'react-hook-form' +import { z } from 'zod' + + +export default function SignUp() { + + const SignupSchema = z.object({ + + username: z.string().min(10, {message:"Minimum 10 character required!"}), + email: z.string().email('Invalid email'), + password: z.string().min(8,{message:"password must be of 8 characters!!"}) + + }) + + + const { register, + handleSubmit, + formState:{errors}, + reset, + } = useForm({ + resolver:zodResolver(SignupSchema), + }); + + const onSubmit =(data: FieldValues) => { + console.log(data); + } + + return ( + +
+
+

Create Your Account

+ +
+ +
+ + + { + errors?.username && (

{`${errors?.username.message}`}

) + } +
+ +
+ + + { + errors?.email && (

{`${errors?.email.message}`}

) + } +
+ +
+ + + { + errors?.password && (

{`${errors?.password.message}`}

) + } +
+ +
+ + +
+ +
+ +
+
+ ); +} diff --git a/www/package-lock.json b/www/package-lock.json index 063381b..5424732 100644 --- a/www/package-lock.json +++ b/www/package-lock.json @@ -13,8 +13,10 @@ "postcss": "8.4.33", "react": "18.2.0", "react-dom": "18.2.0", + "react-hook-form": "^7.52.1", "tailwindcss": "3.4.1", - "typescript": "5.3.3" + "typescript": "5.3.3", + "zod": "^3.23.8" }, "devDependencies": { "@types/node": "20.11.5", @@ -1609,6 +1611,21 @@ "react": "^18.2.0" } }, + "node_modules/react-hook-form": { + "version": "7.52.1", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.52.1.tgz", + "integrity": "sha512-uNKIhaoICJ5KQALYZ4TOaOLElyM+xipord+Ha3crEFhTntdLvWZqVY49Wqd/0GiVCA/f9NjemLeiNPjG7Hpurg==", + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/react-hook-form" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18 || ^19" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -2196,6 +2213,14 @@ "engines": { "node": ">= 14" } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/www/package.json b/www/package.json index a9997ef..41bab67 100644 --- a/www/package.json +++ b/www/package.json @@ -14,8 +14,10 @@ "postcss": "8.4.33", "react": "18.2.0", "react-dom": "18.2.0", + "react-hook-form": "^7.52.1", "tailwindcss": "3.4.1", - "typescript": "5.3.3" + "typescript": "5.3.3", + "zod": "^3.23.8" }, "devDependencies": { "@types/node": "20.11.5",