diff --git a/packages/clerk-js/src/core/resources/SignIn.ts b/packages/clerk-js/src/core/resources/SignIn.ts index 94e7afb944..ea3318856a 100644 --- a/packages/clerk-js/src/core/resources/SignIn.ts +++ b/packages/clerk-js/src/core/resources/SignIn.ts @@ -50,6 +50,8 @@ export class SignIn extends BaseResource implements SignInResource { identifier: string | null = null; createdSessionId: string | null = null; userData: UserData = {}; + // TODO: remove this + isResetFlow = true; constructor(data: SignInJSON | null = null) { super(); diff --git a/packages/clerk-js/src/ui/components/SignIn/ResetPassword.tsx b/packages/clerk-js/src/ui/components/SignIn/ResetPassword.tsx index 5616836f69..15d3433def 100644 --- a/packages/clerk-js/src/ui/components/SignIn/ResetPassword.tsx +++ b/packages/clerk-js/src/ui/components/SignIn/ResetPassword.tsx @@ -6,12 +6,14 @@ import { useCoreClerk, useCoreSignIn, useSignInContext } from '../../contexts'; import { Col, descriptors, localizationKeys } from '../../customizables'; import { Card, CardAlert, Form, Header, useCardState, withCardStateProvider } from '../../elements'; import { useSupportEmail } from '../../hooks/useSupportEmail'; +import { useRouter } from '../../router'; import { handleError, useFormControl } from '../../utils'; export const _ResetPassword = () => { const signIn = useCoreSignIn(); const { navigateAfterSignIn } = useSignInContext(); const card = useCardState(); + const { navigate } = useRouter(); const { setActive } = useCoreClerk(); const supportEmail = useSupportEmail(); const [isCompleted, setCompleted] = useState(false); @@ -38,6 +40,8 @@ export const _ResetPassword = () => { }; const resetPassword = async () => { + passwordField.setError(undefined); + confirmField.setError(undefined); try { const { status, createdSessionId } = await signIn.resetPassword({ password: passwordField.value, @@ -50,8 +54,8 @@ export const _ResetPassword = () => { void setActive({ session: createdSessionId, beforeEmit: navigateAfterSignIn }); }, 2000); return; - // case 'needs_second_factor': - // return navigate('../factor-two'); + case 'needs_second_factor': + return navigate('../factor-two'); default: return console.error(clerkInvalidFAPIResponse(status, supportEmail)); } @@ -64,7 +68,7 @@ export const _ResetPassword = () => { {card.error} - null} /> + navigate('../')} /> return ( Promise;