mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(experience): avoid carring identifer from reset password page to sign-in page (#6526)
This commit is contained in:
parent
aba089285b
commit
347cd3b6b7
1 changed files with 2 additions and 25 deletions
|
@ -21,13 +21,7 @@ const ResetPassword = () => {
|
|||
const { setToast } = useToast();
|
||||
const navigate = useNavigate();
|
||||
const { show } = usePromiseConfirmModal();
|
||||
const {
|
||||
identifierInputValue,
|
||||
setIdentifierInputValue,
|
||||
forgotPasswordIdentifierInputValue,
|
||||
setForgotPasswordIdentifierInputValue,
|
||||
} = useContext(UserInteractionContext);
|
||||
|
||||
const { setForgotPasswordIdentifierInputValue } = useContext(UserInteractionContext);
|
||||
const errorHandlers: ErrorHandlers = useMemo(
|
||||
() => ({
|
||||
'session.verification_session_not_found': async (error) => {
|
||||
|
@ -43,15 +37,6 @@ const ResetPassword = () => {
|
|||
const successHandler: SuccessHandler<typeof setUserPassword> = useCallback(
|
||||
(result) => {
|
||||
if (result) {
|
||||
/**
|
||||
* Improve user experience by caching the identifier input value for sign-in page
|
||||
* when the user is first redirected to the reset password page.
|
||||
* This allows user to continue the sign flow without having to re-enter the identifier.
|
||||
*/
|
||||
if (!identifierInputValue) {
|
||||
setIdentifierInputValue(forgotPasswordIdentifierInputValue);
|
||||
}
|
||||
|
||||
// Clear the forgot password identifier input value after the password is set
|
||||
setForgotPasswordIdentifierInputValue(undefined);
|
||||
|
||||
|
@ -59,15 +44,7 @@ const ResetPassword = () => {
|
|||
navigate('/sign-in', { replace: true });
|
||||
}
|
||||
},
|
||||
[
|
||||
forgotPasswordIdentifierInputValue,
|
||||
identifierInputValue,
|
||||
navigate,
|
||||
setForgotPasswordIdentifierInputValue,
|
||||
setIdentifierInputValue,
|
||||
setToast,
|
||||
t,
|
||||
]
|
||||
[navigate, setForgotPasswordIdentifierInputValue, setToast, t]
|
||||
);
|
||||
|
||||
const [action] = usePasswordAction({
|
||||
|
|
Loading…
Reference in a new issue