0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-13 21:30:30 -05:00

fix(experience): use forgot password identifier in related flow (#6221)

This commit is contained in:
Xiao Yijun 2024-07-11 17:01:52 +08:00 committed by GitHub
parent 9c05106d88
commit ba415c92ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,15 +21,19 @@ const VerificationCode = () => {
const { flow } = useParams<Parameters>(); const { flow } = useParams<Parameters>();
const { signInMethods } = useSieMethods(); 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 />; return <ErrorPage />;
} }
const { type, value } = identifierInputValue ?? {}; const cachedIdentifierInputValue =
flow === UserFlow.ForgotPassword ? forgotPasswordIdentifierInputValue : identifierInputValue;
const { type, value } = cachedIdentifierInputValue ?? {};
if (!type || type === SignInIdentifier.Username || !value) { if (!type || type === SignInIdentifier.Username || !value) {
return <ErrorPage title="error.invalid_session" />; return <ErrorPage title="error.invalid_session" />;
@ -53,10 +57,10 @@ const VerificationCode = () => {
}} }}
> >
<VerificationCodeContainer <VerificationCodeContainer
flow={useFlow} flow={userFlow}
identifier={type} identifier={type}
target={value} target={value}
hasPasswordButton={useFlow === UserFlow.SignIn && methodSettings?.password} hasPasswordButton={userFlow === UserFlow.SignIn && methodSettings?.password}
/> />
</SecondaryPageLayout> </SecondaryPageLayout>
); );