Skip to content

Commit

Permalink
fix(experience): use forgot password identifier in related flow
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyijun committed Jul 11, 2024
1 parent 223d7d6 commit 63f0a0e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/experience/src/pages/VerificationCode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ const VerificationCode = () => {
const { flow } = useParams<Parameters>();
const { signInMethods } = useSieMethods();

const { identifierInputValue } = useContext(UserInteractionContext);
const { identifierInputValue, forgotPasswordIdentifierInputValue } =
useContext(UserInteractionContext);

const [, useFlow] = validate(flow, userFlowGuard);
const [, userFlow] = validate(flow, userFlowGuard);

if (!useFlow) {
if (!userFlow) {
return <ErrorPage />;
}

const { type, value } = identifierInputValue ?? {};
const cachedIdentifierInputValue =
flow === UserFlow.ForgotPassword ? forgotPasswordIdentifierInputValue : identifierInputValue;

const { type, value } = cachedIdentifierInputValue ?? {};

if (!type || type === SignInIdentifier.Username || !value) {
return <ErrorPage title="error.invalid_session" />;
Expand All @@ -53,10 +57,10 @@ const VerificationCode = () => {
}}
>
<VerificationCodeContainer
flow={useFlow}
flow={userFlow}
identifier={type}
target={value}
hasPasswordButton={useFlow === UserFlow.SignIn && methodSettings?.password}
hasPasswordButton={userFlow === UserFlow.SignIn && methodSettings?.password}
/>
</SecondaryPageLayout>
);
Expand Down

0 comments on commit 63f0a0e

Please sign in to comment.