From 670aa79906f65e9e294e1dbd03a13194bce59e5d Mon Sep 17 00:00:00 2001 From: Naterfute Date: Mon, 11 Aug 2025 22:48:59 -0700 Subject: [PATCH] fix: reset password page not having captcha --- .../auth/ResetPasswordContainer.tsx | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/resources/scripts/components/auth/ResetPasswordContainer.tsx b/resources/scripts/components/auth/ResetPasswordContainer.tsx index 0876edf9a..ea6c443c9 100644 --- a/resources/scripts/components/auth/ResetPasswordContainer.tsx +++ b/resources/scripts/components/auth/ResetPasswordContainer.tsx @@ -1,6 +1,6 @@ import { Actions, useStoreActions } from 'easy-peasy'; import { Formik, FormikHelpers } from 'formik'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Link, useParams } from 'react-router-dom'; import { object, ref, string } from 'yup'; @@ -18,6 +18,8 @@ import { httpErrorToHuman } from '@/api/http'; import { ApplicationStore } from '@/state'; +import useFlash from '@/plugins/useFlash'; + import Logo from '../elements/PyroLogo'; interface Values { @@ -28,7 +30,11 @@ interface Values { function ResetPasswordContainer() { const [email, setEmail] = useState(''); - const { clearFlashes, addFlash } = useStoreActions((actions: Actions) => actions.flashes); + const { clearFlashes, clearAndAddHttpError } = useFlash(); + + useEffect(() => { + clearFlashes(); + }, []); const parsed = new URLSearchParams(location.search); if (email.length === 0 && parsed.get('email')) { @@ -60,7 +66,9 @@ function ResetPasswordContainer() { console.error(error); setSubmitting(false); - addFlash({ type: 'error', title: 'Error', message: httpErrorToHuman(error) }); + clearAndAddHttpError({ + error: new Error(error), + }); }); }; @@ -111,6 +119,16 @@ function ResetPasswordContainer() { type={'password'} /> + { + console.error('Captcha error:', error); + clearAndAddHttpError({ + error: new Error('Captcha verification failed. Please try again.'), + }); + }} + /> +