mirror of
https://github.com/logto-io/logto.git
synced 2025-04-07 23:01:25 -05:00
fix(experience): browser password manager should pick up one-time token email from hidden input (#7232)
fix(experience): browser password manager should pick up magic link email from hidden input
This commit is contained in:
parent
c71f25d83e
commit
a4d724782d
1 changed files with 9 additions and 2 deletions
|
@ -6,9 +6,10 @@ import {
|
|||
type RequestErrorBody,
|
||||
} from '@logto/schemas';
|
||||
import { condString } from '@silverhand/essentials';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
import UserInteractionContext from '@/Providers/UserInteractionContextProvider/UserInteractionContext';
|
||||
import {
|
||||
identifyAndSubmitInteraction,
|
||||
signInWithVerifiedIdentifier,
|
||||
|
@ -31,6 +32,7 @@ const OneTimeToken = () => {
|
|||
const asyncSignInWithVerifiedIdentifier = useApi(signInWithVerifiedIdentifier);
|
||||
const asyncRegisterWithOneTimeToken = useApi(registerWithOneTimeToken);
|
||||
|
||||
const { setIdentifierInputValue } = useContext(UserInteractionContext);
|
||||
const { termsValidation, agreeToTermsPolicy } = useTerms();
|
||||
const handleError = useErrorHandler();
|
||||
const redirectTo = useGlobalRedirectTo();
|
||||
|
@ -129,6 +131,10 @@ const OneTimeToken = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
// Set email identifier to the <HiddenIdentifierInput />, so that when being asked for fulfilling
|
||||
// the password later, the browser password manager can pick up both the email and the password.
|
||||
setIdentifierInputValue({ type: SignInIdentifier.Email, value: email });
|
||||
|
||||
await submit(result.verificationId);
|
||||
})();
|
||||
}, [
|
||||
|
@ -136,8 +142,9 @@ const OneTimeToken = () => {
|
|||
params,
|
||||
asyncRegisterWithOneTimeToken,
|
||||
handleError,
|
||||
termsValidation,
|
||||
setIdentifierInputValue,
|
||||
submit,
|
||||
termsValidation,
|
||||
]);
|
||||
|
||||
if (oneTimeTokenError) {
|
||||
|
|
Loading…
Add table
Reference in a new issue