Skip to content

Commit

Permalink
Merge pull request #37145 from rayane-djouah/add-support-for-redirect…
Browse files Browse the repository at this point in the history
…ing-user-to-a-target-url-when-they-click-on-the-magic-link-code

Fixes for feature: Add support for redirecting user to a target URL when they click on the magic link code
  • Loading branch information
techievivek authored Feb 26, 2024
2 parents 56c0218 + fb6195d commit 3b7aebf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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);
});
});
});
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();
} 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)) {
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 && (
<ValidateCodeModal
accountID={Number(accountID)}
code={validateCode}
Expand Down

0 comments on commit 3b7aebf

Please sign in to comment.