From 14c0576f7ba645f19f58c96288df477b7beb09dd Mon Sep 17 00:00:00 2001 From: iamhectorsosa Date: Thu, 14 Mar 2024 13:54:16 +0100 Subject: [PATCH] Updating --- .../app/login/reset-password/new/page.tsx | 23 +++ apps/next/app/login/reset-password/page.tsx | 23 +++ apps/next/components/user/account-form.tsx | 8 +- apps/next/components/user/login-form.tsx | 17 +- .../user/new-reset-password-form.tsx | 156 ++++++++++++++++++ apps/next/components/user/profile-form.tsx | 8 +- apps/next/components/user/register-form.tsx | 8 +- .../components/user/reset-password-form.tsx | 150 +++++++++++++++++ apps/next/modules/user/auth.ts | 17 ++ 9 files changed, 394 insertions(+), 16 deletions(-) create mode 100644 apps/next/app/login/reset-password/new/page.tsx create mode 100644 apps/next/app/login/reset-password/page.tsx create mode 100644 apps/next/components/user/new-reset-password-form.tsx create mode 100644 apps/next/components/user/reset-password-form.tsx diff --git a/apps/next/app/login/reset-password/new/page.tsx b/apps/next/app/login/reset-password/new/page.tsx new file mode 100644 index 0000000..d5181d4 --- /dev/null +++ b/apps/next/app/login/reset-password/new/page.tsx @@ -0,0 +1,23 @@ +import { NewResetPasswordForm } from "@/components/user/new-reset-password-form"; +import { useSupabaseServer } from "@/modules/utils/server"; +import { cookies } from "next/headers"; + +import { redirect } from "next/navigation"; + +export default async function Page() { + const supabase = useSupabaseServer({ cookies }); + + const { + data: { user }, + } = await supabase.auth.getUser(); + + if (!user) { + redirect("/login"); + } + + return ( +
+ +
+ ); +} diff --git a/apps/next/app/login/reset-password/page.tsx b/apps/next/app/login/reset-password/page.tsx new file mode 100644 index 0000000..e5106f7 --- /dev/null +++ b/apps/next/app/login/reset-password/page.tsx @@ -0,0 +1,23 @@ +import { ResetPasswordForm } from "@/components/user/reset-password-form"; +import { useSupabaseServer } from "@/modules/utils/server"; +import { cookies } from "next/headers"; + +import { redirect } from "next/navigation"; + +export default async function Page() { + const supabase = useSupabaseServer({ cookies }); + + const { + data: { user }, + } = await supabase.auth.getUser(); + + if (user) { + redirect("/settings"); + } + + return ( +
+ +
+ ); +} diff --git a/apps/next/components/user/account-form.tsx b/apps/next/components/user/account-form.tsx index c308444..f478952 100644 --- a/apps/next/components/user/account-form.tsx +++ b/apps/next/components/user/account-form.tsx @@ -165,16 +165,16 @@ const AccountFormComponent: React.FC<{ )} -