1- "use client"
1+ "use client" ;
22
3- import { cn } from "@/lib/utils"
4- import { Button } from "@/components/ui/button"
3+ import { cn } from "@/lib/utils" ;
4+ import { Button } from "@/components/ui/button" ;
55import {
66 Field ,
77 FieldDescription ,
88 FieldGroup ,
99 FieldLabel ,
10- } from "@/components/ui/field"
11- import { Input } from "@/components/ui/input"
12- import { useState } from "react"
13- import { Loader2 , ArrowLeft } from "lucide-react"
14- import { authClient } from "@/lib/auth/client"
15- import { toast } from "sonner"
16- import Link from "next/link"
10+ } from "@/components/ui/field" ;
11+ import { Input } from "@/components/ui/input" ;
12+ import { useState } from "react" ;
13+ import { Loader2 , ArrowLeft } from "lucide-react" ;
14+ import { authClient } from "@/lib/auth/client" ;
15+ import { toast } from "sonner" ;
16+ import Link from "next/link" ;
1717
1818export function ForgotPassword ( {
1919 className,
2020 ...props
2121} : React . ComponentProps < "form" > ) {
22- const [ email , setEmail ] = useState ( "" )
23- const [ loading , setLoading ] = useState ( false )
24- const [ submitted , setSubmitted ] = useState ( false )
22+ const [ email , setEmail ] = useState ( "" ) ;
23+ const [ loading , setLoading ] = useState ( false ) ;
24+ const [ submitted , setSubmitted ] = useState ( false ) ;
2525
2626 const handleForgotPassword = async ( e : React . FormEvent ) => {
27- e . preventDefault ( )
27+ e . preventDefault ( ) ;
2828
2929 if ( ! email ) {
30- toast . error ( "Please enter your email address" )
31- return
30+ toast . error ( "Please enter your email address" ) ;
31+ return ;
3232 }
3333
34- setLoading ( true )
34+ setLoading ( true ) ;
3535 try {
3636 await authClient . requestPasswordReset ( {
3737 email,
3838 redirectTo : `${ window . location . origin } /reset-password` ,
39- } )
40- setSubmitted ( true )
41- toast . success ( "Check your email for the password reset link!" )
39+ } ) ;
40+ setSubmitted ( true ) ;
41+ toast . success ( "Check your email for the password reset link!" ) ;
4242 } catch ( error : any ) {
43- console . error ( "Forgot password error:" , error )
44- toast . error ( error ?. message || "Failed to send reset password link. Please try again." )
43+ console . error ( "Forgot password error:" , error ) ;
44+ toast . error (
45+ error ?. message ||
46+ "Failed to send reset password link. Please try again." ,
47+ ) ;
4548 } finally {
46- setLoading ( false )
49+ setLoading ( false ) ;
4750 }
48- }
51+ } ;
4952
5053 if ( submitted ) {
5154 return (
@@ -72,7 +75,8 @@ export function ForgotPassword({
7275 We've sent a password reset link to < strong > { email } </ strong >
7376 </ p >
7477 < p className = "text-muted-foreground text-sm text-balance" >
75- Click the link in the email to reset your password. The link will expire in 24 hours.
78+ Click the link in the email to reset your password. The link will
79+ expire in 24 hours.
7680 </ p >
7781 </ div >
7882 < Field >
@@ -95,16 +99,21 @@ export function ForgotPassword({
9599 </ Field >
96100 </ FieldGroup >
97101 </ div >
98- )
102+ ) ;
99103 }
100104
101105 return (
102- < form className = { cn ( "flex flex-col gap-6" , className ) } onSubmit = { handleForgotPassword } { ...props } >
106+ < form
107+ className = { cn ( "flex flex-col gap-6" , className ) }
108+ onSubmit = { handleForgotPassword }
109+ { ...props }
110+ >
103111 < FieldGroup >
104112 < div className = "flex flex-col items-center gap-1 text-center" >
105113 < h1 className = "text-2xl font-bold" > Forgot your password?</ h1 >
106114 < p className = "text-muted-foreground text-sm text-balance" >
107- Enter your email address and we'll send you a link to reset your password.
115+ Enter your email address and we'll send you a link to reset your
116+ password.
108117 </ p >
109118 </ div >
110119 < Field >
@@ -144,5 +153,5 @@ export function ForgotPassword({
144153 </ Field >
145154 </ FieldGroup >
146155 </ form >
147- )
156+ ) ;
148157}
0 commit comments