Skip to content

armgit / E2B

Public Imported from GitHub
0

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

[WIP] Add update password redirect

Tomas Valentabcf9e010d86c
diff --git a/apps/web/src/app/(auth)/auth/update-password/page.tsx b/apps/web/src/app/(auth)/auth/update-password/page.tsx
new file mode 100644
index 000000000..57f0f3dd8
--- /dev/null
+++ b/apps/web/src/app/(auth)/auth/update-password/page.tsx
@@ -0,0 +1,12 @@
+'use client'
+
+import AuthForm from '@/components/AuthForm'
+import { Suspense } from 'react'
+
+export default function UpdatePassword() {
+ return (
+ <Suspense>
+ <AuthForm view="update_password" />
+ </Suspense>
+ )
+}
diff --git a/apps/web/src/components/AuthForm.tsx b/apps/web/src/components/AuthForm.tsx
index 1bad8ca3b..9e46b2587 100644
--- a/apps/web/src/components/AuthForm.tsx
+++ b/apps/web/src/components/AuthForm.tsx
@@ -4,6 +4,7 @@ import Link from 'next/link'
import { Auth } from '@supabase/auth-ui-react'
import {
ThemeSupa,
+ ViewType,
} from '@supabase/auth-ui-shared'
import { createClientComponentClient } from '@supabase/auth-helpers-nextjs'
import { useSearchParams, useRouter } from 'next/navigation'
@@ -14,7 +15,7 @@ import { useUser } from '@/utils/useUser'
const supabase = createClientComponentClient()
export interface Props {
- view: 'sign_in' | 'sign_up' | 'forgotten_password'
+ view: ViewType
}
function AuthForm({ view }: Props) {
@@ -35,6 +36,7 @@ function AuthForm({ view }: Props) {
{view === 'sign_in' && 'Sign in to E2B'}
{view === 'sign_up' && 'Create new E2B account'}
{view === 'forgotten_password' && 'Reset password'}
+ {view === 'update_password' && 'Update password'}
</h1>
<div className="md:w-[420px] w-[240px]">
<Auth
@@ -63,12 +65,16 @@ function AuthForm({ view }: Props) {
providerScopes={{
github: 'email',
}}
- redirectTo={redirectTo}
+ redirectTo={
+ view === 'forgotten_password'
+ ? 'https://e2b.dev/auth/update-password'
+ : redirectTo
+ }
/>
</div>
<div className="flex flex-1 flex-col pt-4">
- {(view === 'sign_up' || view === 'forgotten_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}`}>
diff --git a/apps/web/src/styles/tailwind.css b/apps/web/src/styles/tailwind.css
index 7ab4a93f4..4ec47a660 100644
--- a/apps/web/src/styles/tailwind.css
+++ b/apps/web/src/styles/tailwind.css
@@ -66,6 +66,7 @@
#auth-sign-up button,
#auth-forgot-password button,
+ #auth-update-password button,
#auth-sign-in button {
border: none;
@apply text-base font-medium transition;
@@ -73,12 +74,13 @@
}
#auth-forgot-password label,
+ #auth-update-password label,
#auth-sign-up label,
#auth-sign-in label {
@apply text-sm font-medium text-zinc-500 transition;
}
-
+ #auth-update-password input,
#auth-forgot-password input,
#auth-sign-up input,
#auth-sign-in input {