Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for feature: Add support for redirecting user to a target URL when they click on the magic link code #37145

2 changes: 1 addition & 1 deletion src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ function handleExitToNavigation(exitTo: Routes | HybridAppRoute) {
waitForUserSignIn().then(() => {
Navigation.waitForProtectedRoutes().then(() => {
const url = NativeModules.HybridAppModule ? Navigation.parseHybridAppUrl(exitTo) : exitTo;
Navigation.navigate(url, CONST.NAVIGATION.TYPE.FORCED_UP);
Navigation.navigate(url);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #36603

});
});
});
Expand Down
4 changes: 4 additions & 0 deletions src/pages/ValidateLoginPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function ValidateLoginPage({
if (session?.authToken) {
// If already signed in, do not show the validate code if not on web,
// because we don't want to block the user with the interstitial page.
if (exitTo) {
Session.handleExitToNavigation(exitTo);
return;
}
Navigation.goBack();
Copy link
Contributor Author

@rayane-djouah rayane-djouah Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when user is already signed in on native app, navigation to exitTo path was not performed.
This change fixes this case.

} else {
Session.signInWithValidateCodeAndNavigate(Number(accountID), validateCode, '', exitTo);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/ValidateLoginPage/index.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function ValidateLoginPage({
}
Session.initAutoAuthState(autoAuthState);

if (isSignedIn || !login) {
if (isSignedIn || (!login && !exitTo)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic code page was displayed if we open the link in a separate browser, user need to click "just sign in here" link to navigate to the exit path:

image

with this fix, we sign in the user and navigate without the need to click "just sign in here" link

if (exitTo) {
Session.handleExitToNavigation(exitTo);
}
Expand Down Expand Up @@ -64,8 +64,8 @@ function ValidateLoginPage({
<>
{autoAuthState === CONST.AUTO_AUTH_STATE.FAILED && <ExpiredValidateCodeModal />}
{autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && is2FARequired && !isSignedIn && <JustSignedInModal is2FARequired />}
{autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && <JustSignedInModal is2FARequired={false} />}
{autoAuthState === CONST.AUTO_AUTH_STATE.NOT_STARTED && (
{autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && !exitTo && <JustSignedInModal is2FARequired={false} />}
{autoAuthState === CONST.AUTO_AUTH_STATE.NOT_STARTED && !exitTo && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes #36325 (comment)

<ValidateCodeModal
accountID={Number(accountID)}
code={validateCode}
Expand Down
Loading