Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix login

Jakub Novak4daeb77b6c69
diff --git a/apps/web/src/components/AuthForm.tsx b/apps/web/src/components/AuthForm.tsx
index f80fd0360..6f9726a32 100644
--- a/apps/web/src/components/AuthForm.tsx
+++ b/apps/web/src/components/AuthForm.tsx
@@ -2,10 +2,7 @@
import Link from 'next/link'
import { Auth } from '@supabase/auth-ui-react'
-import {
- ThemeSupa,
- ViewType,
-} from '@supabase/auth-ui-shared'
+import { ThemeSupa, ViewType } from '@supabase/auth-ui-shared'
import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'
import { useSearchParams, useRouter } from 'next/navigation'
import { useEffect } from 'react'
@@ -20,19 +17,22 @@ export interface Props {
function AuthForm({ view }: Props) {
const searchParams = useSearchParams()
- const redirectTo = searchParams?.get('redirect_to') || undefined
+ const redirectTo = searchParams?.get('redirect_to') || '/dashboard'
const router = useRouter()
const user = useUser()
- useEffect(function redirect() {
- if (user.user && redirectTo) {
- router.push(redirectTo)
- }
+ useEffect(
+ function redirect() {
+ if (user.user && redirectTo) {
+ router.push(redirectTo)
+ }
- if (user.wasUpdated && !redirectTo) {
- router.push('/dashboard')
- }
- }, [user.user, router, redirectTo, view, user.wasUpdated])
+ if (user.wasUpdated && !redirectTo) {
+ router.push('/dashboard')
+ }
+ },
+ [user.user, router, redirectTo, view, user.wasUpdated]
+ )
return (
<div className="mx-auto flex flex-1 w-full justify-center items-center flex-col pt-4">
@@ -79,43 +79,36 @@ function AuthForm({ view }: Props) {
</div>
<div className="flex flex-1 flex-col pt-4">
- {(view === 'sign_up' || view === 'forgotten_password' || view === 'update_password') &&
+ {(view === 'sign_up' ||
+ view === 'forgotten_password' ||
+ view === 'update_password') && (
<div className="flex items-center justify-start gap-2">
<span className="text-zinc-400">Already have an account?</span>
- <Link className="flex items-center justify-center" href={`/auth/sign-in?redirect_to=${redirectTo}`}>
- <Button
- variant="textLink"
- >
- Sign in
- </Button>
+ <Link
+ className="flex items-center justify-center"
+ href={`/auth/sign-in?redirect_to=${redirectTo}`}
+ >
+ <Button variant="textLink">Sign in</Button>
</Link>
</div>
- }
+ )}
- {view === 'sign_in' &&
+ {view === 'sign_in' && (
<Link className="text-center" href="/auth/reset-password">
- <Button
- variant="textSubtle"
- >
- Forgot your password?
- </Button>
+ <Button variant="textSubtle">Forgot your password?</Button>
</Link>
- }
+ )}
- {view === 'sign_in' &&
+ {view === 'sign_in' && (
<div className="flex items-center justify-start gap-2">
- <span className="text-zinc-400">{'Don\'t have an account?'}</span>
+ <span className="text-zinc-400">{"Don't have an account?"}</span>
<Link href={`/auth/sign-up?redirect_to=${redirectTo}`}>
- <Button
- variant="textLink"
- >
- Sign up
- </Button>
+ <Button variant="textLink">Sign up</Button>
</Link>
</div>
- }
+ )}
</div>
- </div >
+ </div>
)
}
diff --git a/apps/web/src/pages/_404/[...path].tsx b/apps/web/src/pages/_404/[...path].tsx
index ea507a364..3be8c9c6f 100644
--- a/apps/web/src/pages/_404/[...path].tsx
+++ b/apps/web/src/pages/_404/[...path].tsx
@@ -4,7 +4,7 @@ import { GetServerSideProps } from 'next'
export const getServerSideProps: GetServerSideProps = async () => {
return {
redirect: {
- destination: '/dashboard',
+ destination: '/',
permanent: false,
},
}