From 1ada4007b5afd245594f106c8a2a6d55a4c2b643 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Fri, 7 Apr 2023 12:42:13 -0700 Subject: [PATCH] Merge pull request #17141 from Expensify/cristi_fix-magic-link-on-mobile-native Fix automatic authentication with magic link on mobile native (cherry picked from commit 58b2bbb231657283f66112df228db0a33b3e9abc) --- src/libs/actions/Session/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js index bb4314b19aa8..a2245fe47672 100644 --- a/src/libs/actions/Session/index.js +++ b/src/libs/actions/Session/index.js @@ -18,6 +18,7 @@ import * as NetworkStore from '../../Network/NetworkStore'; import * as Report from '../Report'; import DateUtils from '../../DateUtils'; import Navigation from '../../Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; let credentials = {}; Onyx.connect({ @@ -402,6 +403,11 @@ function signInWithValidateCode(accountID, validateCode, twoFactorAuthCode) { }, {optimisticData, successData, failureData}); } +function signInWithValidateCodeAndNavigate(accountID, validateCode, twoFactorAuthCode) { + signInWithValidateCode(accountID, validateCode, twoFactorAuthCode); + Navigation.navigate(ROUTES.HOME); +} + /** * Initializes the state of the automatic authentication when the user clicks on a magic link. * @@ -641,6 +647,7 @@ export { updatePasswordAndSignin, signIn, signInWithValidateCode, + signInWithValidateCodeAndNavigate, initAutoAuthState, signInWithShortLivedAuthToken, cleanupSession,