diff --git a/apps/dashboard/src/app/(auth)/login/[[...login]]/page.tsx b/apps/dashboard/src/app/(auth)/login/[[...login]]/page.tsx
new file mode 100644
index 00000000..33d59d16
--- /dev/null
+++ b/apps/dashboard/src/app/(auth)/login/[[...login]]/page.tsx
@@ -0,0 +1,9 @@
+import { SignIn } from '@clerk/nextjs';
+
+export default function Page() {
+ return (
+
+
+
+ );
+}
diff --git a/apps/dashboard/src/app/(auth)/login/email-sign-in.tsx b/apps/dashboard/src/app/(auth)/login/email-sign-in.tsx
deleted file mode 100644
index 3b9a18d5..00000000
--- a/apps/dashboard/src/app/(auth)/login/email-sign-in.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { useEffect } from 'react';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { getClerkError } from '@/utils/clerk-error';
-import { useSignIn } from '@clerk/nextjs';
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useRouter } from 'next/navigation';
-import { useForm } from 'react-hook-form';
-import { toast } from 'sonner';
-import { z } from 'zod';
-
-const validator = z.object({
- email: z.string().email(),
- password: z.string().min(8),
-});
-
-type IForm = z.infer;
-
-const EmailSignUp = () => {
- const router = useRouter();
- const { isLoaded, signIn, setActive } = useSignIn();
-
- const form = useForm({
- resolver: zodResolver(validator),
- });
-
- useEffect(() => {
- if (form.formState.errors.email?.message) {
- toast.error(`Email: ${form.formState.errors.email?.message}`);
- }
- }, [form.formState.errors.email?.message]);
-
- useEffect(() => {
- if (form.formState.errors.password?.message) {
- toast.error(`Password: ${form.formState.errors.password?.message}`);
- }
- }, [form.formState.errors.password?.message]);
-
- return (
-
- );
-};
-
-export default EmailSignUp;
diff --git a/apps/dashboard/src/app/(auth)/login/page.client.tsx b/apps/dashboard/src/app/(auth)/login/page.client.tsx
deleted file mode 100644
index d5ba9c65..00000000
--- a/apps/dashboard/src/app/(auth)/login/page.client.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-'use client';
-
-import type { OAuthStrategy } from '@/types';
-import { useSignIn } from '@clerk/nextjs';
-import { toast } from 'sonner';
-
-import EmailSignUp from './email-sign-in';
-
-const PageClient = () => {
- const { signIn } = useSignIn();
-
- const signInWith = (strategy: OAuthStrategy) => {
- if (!signIn) {
- return toast.error('Sign in is not available at the moment');
- }
- return signIn.authenticateWithRedirect({
- strategy,
- redirectUrl: '/sso-callback',
- redirectUrlComplete: '/',
- });
- };
-
- return (
-
-
-
Sign in
-
-
-
-
-
-
- No account?{' '}
-
- Create one now
-
-
-
-
-
- );
-};
-
-export default PageClient;
diff --git a/apps/dashboard/src/app/(auth)/login/page.tsx b/apps/dashboard/src/app/(auth)/login/page.tsx
deleted file mode 100644
index 1b9019ad..00000000
--- a/apps/dashboard/src/app/(auth)/login/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { auth } from '@clerk/nextjs/server';
-import { redirect } from 'next/navigation';
-
-import PageClient from './page.client';
-
-export const dynamic = 'force-dynamic';
-
-// Sign up
-const Page = () => {
- const session = auth();
- if (session.userId) {
- return redirect('/');
- }
- return ;
-};
-
-export default Page;
diff --git a/apps/dashboard/src/app/(auth)/register/[[...register]]/page.tsx b/apps/dashboard/src/app/(auth)/register/[[...register]]/page.tsx
new file mode 100644
index 00000000..0bb2fa30
--- /dev/null
+++ b/apps/dashboard/src/app/(auth)/register/[[...register]]/page.tsx
@@ -0,0 +1,9 @@
+import { SignUp } from '@clerk/nextjs';
+
+export default function Page() {
+ return (
+
+
+
+ );
+}
diff --git a/apps/dashboard/src/app/(auth)/register/email-sign-up.tsx b/apps/dashboard/src/app/(auth)/register/email-sign-up.tsx
deleted file mode 100644
index 3d5653f8..00000000
--- a/apps/dashboard/src/app/(auth)/register/email-sign-up.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-import { useEffect } from 'react';
-import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { pushModal } from '@/modals';
-import { getClerkError } from '@/utils/clerk-error';
-import { useSignUp } from '@clerk/nextjs';
-import { zodResolver } from '@hookform/resolvers/zod';
-import { useForm } from 'react-hook-form';
-import { toast } from 'sonner';
-import { z } from 'zod';
-
-const validator = z.object({
- email: z.string().email(),
- password: z.string().min(8),
-});
-
-type IForm = z.infer;
-
-const EmailSignUp = () => {
- const { isLoaded, signUp } = useSignUp();
-
- const form = useForm({
- resolver: zodResolver(validator),
- });
-
- useEffect(() => {
- if (form.formState.errors.email?.message) {
- toast.error(`Email: ${form.formState.errors.email?.message}`);
- }
- }, [form.formState.errors.email?.message]);
-
- useEffect(() => {
- if (form.formState.errors.password?.message) {
- toast.error(`Password: ${form.formState.errors.password?.message}`);
- }
- }, [form.formState.errors.password?.message]);
-
- return (
-
- );
-};
-
-export default EmailSignUp;
diff --git a/apps/dashboard/src/app/(auth)/register/page.client.tsx b/apps/dashboard/src/app/(auth)/register/page.client.tsx
deleted file mode 100644
index 6239db2e..00000000
--- a/apps/dashboard/src/app/(auth)/register/page.client.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-'use client';
-
-import type { OAuthStrategy } from '@/types';
-import { useSignUp } from '@clerk/nextjs';
-import { toast } from 'sonner';
-
-import EmailSignUp from './email-sign-up';
-
-const PageClient = () => {
- const { signUp } = useSignUp();
-
- const signInWith = (strategy: OAuthStrategy) => {
- if (!signUp) {
- return toast.error('Sign in is not available at the moment');
- }
- return signUp.authenticateWithRedirect({
- strategy,
- redirectUrl: '/sso-callback',
- redirectUrlComplete: '/',
- });
- };
-
- return (
-
-
-
Create an account
-
-
-
-
-
-
- Already have an account?{' '}
-
- Sign in
-
-
-
-
-
- );
-};
-
-export default PageClient;
diff --git a/apps/dashboard/src/app/(auth)/register/page.tsx b/apps/dashboard/src/app/(auth)/register/page.tsx
deleted file mode 100644
index 1b9019ad..00000000
--- a/apps/dashboard/src/app/(auth)/register/page.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { auth } from '@clerk/nextjs/server';
-import { redirect } from 'next/navigation';
-
-import PageClient from './page.client';
-
-export const dynamic = 'force-dynamic';
-
-// Sign up
-const Page = () => {
- const session = auth();
- if (session.userId) {
- return redirect('/');
- }
- return ;
-};
-
-export default Page;
diff --git a/apps/dashboard/src/middleware.ts b/apps/dashboard/src/middleware.ts
index df7f338e..44ac1780 100644
--- a/apps/dashboard/src/middleware.ts
+++ b/apps/dashboard/src/middleware.ts
@@ -6,8 +6,8 @@ import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
const isPublicRoute = createRouteMatcher([
'/share/overview/:id',
'/api/clerk/(.*)?',
- '/login',
- '/register',
+ '/login(.*)?',
+ '/register(.*)?',
'/sso-callback(.*)?',
]);