Skip to content

Commit

Permalink
Revert "Fix here is your magic code shows briefly when login with mag…
Browse files Browse the repository at this point in the history
…ic link"
  • Loading branch information
MonilBhavsar authored Apr 23, 2024
1 parent 64695c8 commit 41ee713
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pages/ValidateLoginPage/index.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ function ValidateLoginPage({
const isSignedIn = !!session?.authToken && session?.authTokenType !== CONST.AUTH_TOKEN_TYPES.ANONYMOUS;
const is2FARequired = !!account?.requiresTwoFactorAuth;
const cachedAccountID = credentials?.accountID;
const isUserClickedSignIn = !login && isSignedIn && (autoAuthState === CONST.AUTO_AUTH_STATE.SIGNING_IN || autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN);
const shouldStartSignInWithValidateCode = !isUserClickedSignIn && !isSignedIn && (!!login || !!exitTo);

useEffect(() => {
if (isUserClickedSignIn) {
if (!login && isSignedIn && (autoAuthState === CONST.AUTO_AUTH_STATE.SIGNING_IN || autoAuthState === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN)) {
// The user clicked the option to sign in the current tab
Navigation.isNavigationReady().then(() => {
Navigation.goBack();
Expand All @@ -37,7 +35,7 @@ function ValidateLoginPage({
}
Session.initAutoAuthState(autoAuthState);

if (!shouldStartSignInWithValidateCode) {
if (isSignedIn || (!login && !exitTo)) {
if (exitTo) {
Session.handleExitToNavigation(exitTo);
}
Expand Down Expand Up @@ -73,13 +71,13 @@ 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 && !exitTo && <JustSignedInModal is2FARequired={false} />}
{autoAuthState === CONST.AUTO_AUTH_STATE.NOT_STARTED && !exitTo && !shouldStartSignInWithValidateCode && (
{autoAuthState === CONST.AUTO_AUTH_STATE.NOT_STARTED && !exitTo && (
<ValidateCodeModal
accountID={Number(accountID)}
code={validateCode}
/>
)}
{(autoAuthState === CONST.AUTO_AUTH_STATE.SIGNING_IN || shouldStartSignInWithValidateCode) && <FullScreenLoadingIndicator />}
{autoAuthState === CONST.AUTO_AUTH_STATE.SIGNING_IN && <FullScreenLoadingIndicator />}
</>
);
}
Expand Down

0 comments on commit 41ee713

Please sign in to comment.