From f94eb5b2428fcf2343b07c53f6197d21ec4787f3 Mon Sep 17 00:00:00 2001 From: Tyler Myracle Date: Sat, 13 Jan 2024 11:03:03 -0600 Subject: [PATCH] continue cleaning up and removing Auth0 --- apps/client/pages/_app.tsx | 2 - apps/client/pages/api/auth/[...nextauth].ts | 4 +- apps/client/pages/login.tsx | 5 +- .../server/src/app/routes/auth-user.router.ts | 6 -- apps/server/src/app/routes/index.ts | 1 - .../features/src/user-details/UserDetails.tsx | 15 +---- .../src/components/dialogs/FeedbackDialog.tsx | 6 +- .../shared/src/providers/AuthProvider.tsx | 64 ------------------- .../shared/src/providers/AxiosProvider.tsx | 6 -- libs/client/shared/src/providers/index.ts | 1 - 10 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 apps/server/src/app/routes/auth-user.router.ts delete mode 100644 libs/client/shared/src/providers/AuthProvider.tsx diff --git a/apps/client/pages/_app.tsx b/apps/client/pages/_app.tsx index 9b608036..dc9ecf1f 100644 --- a/apps/client/pages/_app.tsx +++ b/apps/client/pages/_app.tsx @@ -50,8 +50,6 @@ const WithAuth = function ({ children }: PropsWithChildren) { {children} - - {/* Add, edit, delete connections and manual accounts */} diff --git a/apps/client/pages/api/auth/[...nextauth].ts b/apps/client/pages/api/auth/[...nextauth].ts index f6ecd82f..3a18412a 100644 --- a/apps/client/pages/api/auth/[...nextauth].ts +++ b/apps/client/pages/api/auth/[...nextauth].ts @@ -104,7 +104,9 @@ export const authOptions = { const existingUser = await getAuthUserByEmail(email) if (existingUser) { const isPasswordMatch = await bcrypt.compare(password, existingUser.password!) - if (!isPasswordMatch) throw new Error('Email or password is invalid.') + if (!isPasswordMatch) { + throw new Error('Email or password is invalid.') + } return existingUser } diff --git a/apps/client/pages/login.tsx b/apps/client/pages/login.tsx index f9281725..84634495 100644 --- a/apps/client/pages/login.tsx +++ b/apps/client/pages/login.tsx @@ -17,7 +17,9 @@ export default function LoginPage() { const router = useRouter() useEffect(() => { - if (session) router.push('/') + if (session) { + router.push('/') + } }, [session, router]) const onSubmit = async (e: React.FormEvent) => { @@ -36,7 +38,6 @@ export default function LoginPage() { } } - // _app.tsx will automatically redirect if not authenticated return ( <>