(e: FormEvent<HTMLFormElement>)
| 41 | const [isLoading, setIsLoading] = useState(false); |
| 42 | |
| 43 | const onSendEmail = async (e: FormEvent<HTMLFormElement>) => { |
| 44 | e.preventDefault(); |
| 45 | logEvent({ |
| 46 | event_name: AuthEventNames.SubmitForgotPassword, |
| 47 | }); |
| 48 | const { email } = formToJson<{ email: string }>(e.currentTarget); |
| 49 | setEmail(email); |
| 50 | |
| 51 | setIsLoading(true); |
| 52 | setHint(''); |
| 53 | const redirectTo = `${window.location.origin}/reset-password`; |
| 54 | const res = await betterAuthForgetPassword(email, redirectTo); |
| 55 | setIsLoading(false); |
| 56 | |
| 57 | if (res.error) { |
| 58 | setHint(res.error); |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | setEmailSent(true); |
| 63 | }; |
| 64 | |
| 65 | const headerBack = hasTopBarBack ? undefined : onBack; |
| 66 | const backToLogin = simplified && onBack && ( |
nothing calls this directly
no test coverage detected