diff --git a/apps/ui-library/registry/default/blocks/password-based-auth-nextjs/components/forgot-password-form.tsx b/apps/ui-library/registry/default/blocks/password-based-auth-nextjs/components/forgot-password-form.tsx index 5f2ef4852d8..e288b984a83 100644 --- a/apps/ui-library/registry/default/blocks/password-based-auth-nextjs/components/forgot-password-form.tsx +++ b/apps/ui-library/registry/default/blocks/password-based-auth-nextjs/components/forgot-password-form.tsx @@ -18,6 +18,7 @@ import { useState } from 'react' export function ForgotPasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) { const [email, setEmail] = useState('') const [error, setError] = useState(null) + const [success, setSuccess] = useState(false) const [isLoading, setIsLoading] = useState(false) const supabase = createClient() @@ -32,6 +33,7 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps redirectTo: 'http://localhost:3000/update-password', }) if (error) throw error + setSuccess(true) } catch (error: unknown) { setError(error instanceof Error ? error.message : 'An error occurred') } finally { @@ -41,41 +43,56 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps return (
- - - Reset Your Password - - Type in your email and we'll send you a link to reset your password - - - -
-
-
- - setEmail(e.target.value)} - /> + {success ? ( + + + Check Your Email + Password reset instructions sent + + +

+ If you registered using your email and password, you will receive a password reset + email. +

+
+
+ ) : ( + + + Reset Your Password + + Type in your email and we'll send you a link to reset your password + + + + +
+
+ + setEmail(e.target.value)} + /> +
+ {error &&

{error}

} +
- {error &&

{error}

} - -
-
- Already have an account?{' '} - - Login - -
- - - +
+ Already have an account?{' '} + + Login + +
+ + + + )}
) } diff --git a/apps/ui-library/registry/default/blocks/password-based-auth-tanstack/components/forgot-password-form.tsx b/apps/ui-library/registry/default/blocks/password-based-auth-tanstack/components/forgot-password-form.tsx index d3f3e81190b..fb5bf13be5d 100644 --- a/apps/ui-library/registry/default/blocks/password-based-auth-tanstack/components/forgot-password-form.tsx +++ b/apps/ui-library/registry/default/blocks/password-based-auth-tanstack/components/forgot-password-form.tsx @@ -16,6 +16,7 @@ import { useState } from 'react' export function ForgotPasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) { const [email, setEmail] = useState('') const [error, setError] = useState(null) + const [success, setSuccess] = useState(false) const [isLoading, setIsLoading] = useState(false) const supabase = createClient() @@ -30,6 +31,7 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps redirectTo: 'http://localhost:3000/update-password', }) if (error) throw error + setSuccess(true) } catch (error: unknown) { setError(error instanceof Error ? error.message : 'An error occurred') } finally { @@ -39,41 +41,56 @@ export function ForgotPasswordForm({ className, ...props }: React.ComponentProps return (
- - - Reset Your Password - - Type in your email and we'll send you a link to reset your password - - - -
-
-
- - setEmail(e.target.value)} - /> + {success ? ( + + + Check Your Email + Password reset instructions sent + + +

+ If you registered using your email and password, you will receive a password reset + email. +

+
+
+ ) : ( + + + Reset Your Password + + Type in your email and we'll send you a link to reset your password + + + + +
+
+ + setEmail(e.target.value)} + /> +
+ {error &&

{error}

} +
- {error &&

{error}

} - -
-
- Already have an account?{' '} - - Login - -
- - - +
+ Already have an account?{' '} + + Login + +
+ + + + )}
) }