From 400156a0a29e04433fe830bab235a6c08f0e3fe7 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Fri, 13 Oct 2023 11:57:50 +0900 Subject: [PATCH 01/23] add native view for SAML SignInPage --- .../signin/SAMLSignInPage/index.native.js | 44 +++++++++++++++++++ src/pages/signin/SignInPage.js | 12 ++--- 2 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 src/pages/signin/SAMLSignInPage/index.native.js diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js new file mode 100644 index 000000000000..c4b0ae78bc30 --- /dev/null +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -0,0 +1,44 @@ +import React, {useEffect, useRef} from 'react'; +import {withOnyx} from 'react-native-onyx'; +import PropTypes from 'prop-types'; +import ONYXKEYS from '../../../ONYXKEYS'; +import CONFIG from '../../../CONFIG'; +import WebView from 'react-native-webview'; +import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator'; + +const propTypes = { + /** The credentials of the logged in person */ + credentials: PropTypes.shape({ + /** The email/phone the user logged in with */ + login: PropTypes.string, + }), +}; + +const defaultProps = { + credentials: {}, +}; + +const renderLoading = () => ; + +function SAMLSignInPage({credentials}) { + const webViewRef = useRef(); + const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`; + return ( + {console.log("meep meep navigation changed: " + JSON.stringify(ref))}} + /> + ); +} + +SAMLSignInPage.propTypes = propTypes; +SAMLSignInPage.defaultProps = defaultProps; + +export default withOnyx({ + credentials: {key: ONYXKEYS.CREDENTIALS}, +})(SAMLSignInPage); diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 7da41e2ab474..81abbdb9d1ae 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -96,15 +96,9 @@ function getRenderOptions({hasLogin, hasValidateCode, account, isPrimaryLogin, i const isSAMLRequired = Boolean(account.isSAMLRequired); const hasEmailDeliveryFailure = Boolean(account.hasEmailDeliveryFailure); - // SAML is temporarily restricted to users on the beta or to users signing in on web and mweb - let shouldShowChooseSSOOrMagicCode = false; - let shouldInitiateSAMLLogin = false; - const platform = getPlatform(); - if (Permissions.canUseSAML() || platform === CONST.PLATFORM.WEB || platform === CONST.PLATFORM.DESKTOP) { - // True if the user has SAML required and we're not already loading their account - shouldInitiateSAMLLogin = hasAccount && hasLogin && isSAMLRequired && !hasInitiatedSAMLLogin && account.isLoading; - shouldShowChooseSSOOrMagicCode = hasAccount && hasLogin && isSAMLEnabled && !isSAMLRequired && !isUsingMagicCode; - } + // True if the user has SAML required and we're not already loading their account + const shouldInitiateSAMLLogin = hasAccount && hasLogin && isSAMLRequired && !hasInitiatedSAMLLogin && account.isLoading; + const shouldShowChooseSSOOrMagicCode = hasAccount && hasLogin && isSAMLEnabled && !isSAMLRequired && !isUsingMagicCode; // SAML required users may reload the login page after having already entered their login details, in which // case we want to clear their sign in data so they don't end up in an infinite loop redirecting back to their From 8991e7ef264595e150ed631c8e733291ec213be1 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Fri, 13 Oct 2023 20:18:43 +0900 Subject: [PATCH 02/23] log in with shortlivedtoken when one is returned --- .../signin/SAMLSignInPage/index.native.js | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index c4b0ae78bc30..3825cca0fa97 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -1,10 +1,11 @@ -import React, {useEffect, useRef} from 'react'; +import React, {useCallback, useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import ONYXKEYS from '../../../ONYXKEYS'; import CONFIG from '../../../CONFIG'; import WebView from 'react-native-webview'; import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator'; +import * as Session from '../../../libs/actions/Session'; const propTypes = { /** The credentials of the logged in person */ @@ -23,6 +24,24 @@ const renderLoading = () => ; function SAMLSignInPage({credentials}) { const webViewRef = useRef(); const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`; + + /** + * Handles in-app navigation once we get a response back from Expensify + * + * @param {String} params.type + * @param {String} params.url + */ + const handleNavigationStateChange = useCallback( + ({type, url}) => { + const searchParams = new URLSearchParams(new URL(url).search); + if (searchParams.has('shortLivedAuthToken')) { + const shortLivedAuthToken = searchParams.get('shortLivedAuthToken'); + Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken); + return; + } + }, + [webViewRef], + ); return ( {console.log("meep meep navigation changed: " + JSON.stringify(ref))}} + onNavigationStateChange={handleNavigationStateChange} /> ); } From 0168e72eb1427af2bcc9af8c3f36f208e9e70c4a Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 23 Oct 2023 11:58:50 -0700 Subject: [PATCH 03/23] include const --- src/pages/signin/SignInPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index dd43970d5412..3ccd2061d794 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -100,8 +100,8 @@ function getRenderOptions({hasLogin, hasValidateCode, account, isPrimaryLogin, i const hasEmailDeliveryFailure = Boolean(account.hasEmailDeliveryFailure); // True if the user has SAML required and we haven't already initiated SAML for their account - shouldInitiateSAMLLogin = hasAccount && hasLogin && isSAMLRequired && !hasInitiatedSAMLLogin && account.isLoading; - shouldShowChooseSSOOrMagicCode = hasAccount && hasLogin && isSAMLEnabled && !isSAMLRequired && !isUsingMagicCode; + const shouldInitiateSAMLLogin = hasAccount && hasLogin && isSAMLRequired && !hasInitiatedSAMLLogin && account.isLoading; + const shouldShowChooseSSOOrMagicCode = hasAccount && hasLogin && isSAMLEnabled && !isSAMLRequired && !isUsingMagicCode; // SAML required users may reload the login page after having already entered their login details, in which // case we want to clear their sign in data so they don't end up in an infinite loop redirecting back to their From 9e4b7ae1ba30fe91d62878d4168579b83061b4ea Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 23 Oct 2023 18:33:04 -0700 Subject: [PATCH 04/23] style and clean up --- src/pages/signin/SAMLSignInPage/index.native.js | 11 +++++------ src/pages/signin/SignInPage.js | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 3825cca0fa97..4b4624b56cde 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -1,11 +1,12 @@ import React, {useCallback, useRef} from 'react'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; +import WebView from 'react-native-webview'; import ONYXKEYS from '../../../ONYXKEYS'; import CONFIG from '../../../CONFIG'; -import WebView from 'react-native-webview'; -import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator'; import * as Session from '../../../libs/actions/Session'; +import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; +import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator'; const propTypes = { /** The credentials of the logged in person */ @@ -28,11 +29,10 @@ function SAMLSignInPage({credentials}) { /** * Handles in-app navigation once we get a response back from Expensify * - * @param {String} params.type * @param {String} params.url */ const handleNavigationStateChange = useCallback( - ({type, url}) => { + ({url}) => { const searchParams = new URLSearchParams(new URL(url).search); if (searchParams.has('shortLivedAuthToken')) { const shortLivedAuthToken = searchParams.get('shortLivedAuthToken'); @@ -40,11 +40,10 @@ function SAMLSignInPage({credentials}) { return; } }, - [webViewRef], + [credentials.login], ); return ( Date: Mon, 23 Oct 2023 18:33:21 -0700 Subject: [PATCH 05/23] add SAMLLOadingINdicator --- src/components/SAMLLoadingIndicator.js | 43 +++++++++++++++++++ src/pages/signin/SAMLSignInPage/index.js | 35 +-------------- .../signin/SAMLSignInPage/index.native.js | 4 +- 3 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 src/components/SAMLLoadingIndicator.js diff --git a/src/components/SAMLLoadingIndicator.js b/src/components/SAMLLoadingIndicator.js new file mode 100644 index 000000000000..32438c5359c2 --- /dev/null +++ b/src/components/SAMLLoadingIndicator.js @@ -0,0 +1,43 @@ +import _ from 'underscore'; +import React from 'react'; +import {ActivityIndicator, View, StyleSheet} from 'react-native'; +import styles from '../styles/styles'; +import themeColors from '../styles/themes/default'; +import Icon from './Icon'; +import Text from './Text'; +import * as Expensicons from './Icon/Expensicons'; +import * as Illustrations from './Icon/Illustrations'; +import useLocalize from '../hooks/useLocalize'; + +function SAMLLoadingIndicator() { + const {translate} = useLocalize(); + return ( + + + + + + {translate('samlSignIn.launching')} + + {translate('samlSignIn.oneMoment')} + + + + + + + ); +} + +SAMLLoadingIndicator.displayName = 'SAMLLoadingIndicator'; + +export default SAMLLoadingIndicator; diff --git a/src/pages/signin/SAMLSignInPage/index.js b/src/pages/signin/SAMLSignInPage/index.js index 23ce9b93b8cc..f27a3a310597 100644 --- a/src/pages/signin/SAMLSignInPage/index.js +++ b/src/pages/signin/SAMLSignInPage/index.js @@ -1,16 +1,9 @@ import React, {useEffect} from 'react'; import {withOnyx} from 'react-native-onyx'; -import {View} from 'react-native'; import PropTypes from 'prop-types'; import ONYXKEYS from '../../../ONYXKEYS'; import CONFIG from '../../../CONFIG'; -import Icon from '../../../components/Icon'; -import Text from '../../../components/Text'; -import * as Expensicons from '../../../components/Icon/Expensicons'; -import * as Illustrations from '../../../components/Icon/Illustrations'; -import styles from '../../../styles/styles'; -import themeColors from '../../../styles/themes/default'; -import useLocalize from '../../../hooks/useLocalize'; +import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; const propTypes = { /** The credentials of the logged in person */ @@ -25,36 +18,12 @@ const defaultProps = { }; function SAMLSignInPage({credentials}) { - const {translate} = useLocalize(); - useEffect(() => { window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self'); }, [credentials.login]); return ( - - - - - - {translate('samlSignIn.launching')} - - {translate('samlSignIn.oneMoment')} - - - - - - + ); } diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 4b4624b56cde..25affdbf26fd 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -20,10 +20,8 @@ const defaultProps = { credentials: {}, }; -const renderLoading = () => ; function SAMLSignInPage({credentials}) { - const webViewRef = useRef(); const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`; /** @@ -48,7 +46,7 @@ function SAMLSignInPage({credentials}) { source={{uri: samlLoginURL}} incognito // 'incognito' prop required for Android, issue here https://github.com/react-native-webview/react-native-webview/issues/1352 startInLoadingState - renderLoading={renderLoading} + renderLoading={() => } onNavigationStateChange={handleNavigationStateChange} /> ); From 89dc792ec697c1d12be8ab566c464318e9685eda Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 23 Oct 2023 18:51:18 -0700 Subject: [PATCH 06/23] style --- src/components/SAMLLoadingIndicator.js | 3 +-- src/pages/signin/SAMLSignInPage/index.native.js | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/SAMLLoadingIndicator.js b/src/components/SAMLLoadingIndicator.js index 32438c5359c2..1169436e79e5 100644 --- a/src/components/SAMLLoadingIndicator.js +++ b/src/components/SAMLLoadingIndicator.js @@ -1,6 +1,5 @@ -import _ from 'underscore'; import React from 'react'; -import {ActivityIndicator, View, StyleSheet} from 'react-native'; +import {View, StyleSheet} from 'react-native'; import styles from '../styles/styles'; import themeColors from '../styles/themes/default'; import Icon from './Icon'; diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 25affdbf26fd..ea5621a22a65 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -1,4 +1,4 @@ -import React, {useCallback, useRef} from 'react'; +import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import WebView from 'react-native-webview'; @@ -6,7 +6,6 @@ import ONYXKEYS from '../../../ONYXKEYS'; import CONFIG from '../../../CONFIG'; import * as Session from '../../../libs/actions/Session'; import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; -import FullScreenLoadingIndicator from '../../../components/FullscreenLoadingIndicator'; const propTypes = { /** The credentials of the logged in person */ @@ -35,7 +34,6 @@ function SAMLSignInPage({credentials}) { if (searchParams.has('shortLivedAuthToken')) { const shortLivedAuthToken = searchParams.get('shortLivedAuthToken'); Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken); - return; } }, [credentials.login], From 526cf8f5f124d62d758491fc8e929a5b92d02b0c Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 23 Oct 2023 19:07:06 -0700 Subject: [PATCH 07/23] prettier --- src/pages/signin/SAMLSignInPage/index.js | 4 +--- src/pages/signin/SAMLSignInPage/index.native.js | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.js b/src/pages/signin/SAMLSignInPage/index.js index f27a3a310597..283a3113b61b 100644 --- a/src/pages/signin/SAMLSignInPage/index.js +++ b/src/pages/signin/SAMLSignInPage/index.js @@ -22,9 +22,7 @@ function SAMLSignInPage({credentials}) { window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self'); }, [credentials.login]); - return ( - - ); + return ; } SAMLSignInPage.propTypes = propTypes; diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index ea5621a22a65..afb1dd7d8b4b 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -19,15 +19,14 @@ const defaultProps = { credentials: {}, }; - function SAMLSignInPage({credentials}) { const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`; /** - * Handles in-app navigation once we get a response back from Expensify - * - * @param {String} params.url - */ + * Handles in-app navigation once we get a response back from Expensify + * + * @param {String} params.url + */ const handleNavigationStateChange = useCallback( ({url}) => { const searchParams = new URLSearchParams(new URL(url).search); From c386ce4a67cdd50a36b3c7b2d8ba5d3730ddd06e Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 23 Oct 2023 19:24:27 -0700 Subject: [PATCH 08/23] include platform --- src/pages/signin/SAMLSignInPage/index.native.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index afb1dd7d8b4b..ad478c3c0dfd 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -6,6 +6,7 @@ import ONYXKEYS from '../../../ONYXKEYS'; import CONFIG from '../../../CONFIG'; import * as Session from '../../../libs/actions/Session'; import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; +import getPlatform from '../../../libs/getPlatform'; const propTypes = { /** The credentials of the logged in person */ @@ -20,7 +21,7 @@ const defaultProps = { }; function SAMLSignInPage({credentials}) { - const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`; + const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}&platform=${getPlatform()}`; /** * Handles in-app navigation once we get a response back from Expensify From 5172f95ffe48442ff49530cd2e277feb454119ed Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 25 Oct 2023 15:25:45 -0700 Subject: [PATCH 09/23] pull in changes from infinitered:cdanwards/saml-webview --- .../signin/SAMLSignInPage/index.native.js | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index ad478c3c0dfd..82d353680605 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -7,6 +7,9 @@ import CONFIG from '../../../CONFIG'; import * as Session from '../../../libs/actions/Session'; import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; import getPlatform from '../../../libs/getPlatform'; +import FullPageOfflineBlockingView from '../../../components/BlockingViews/FullPageOfflineBlockingView'; +import HeaderWithBackButton from '../../../components/HeaderWithBackButton'; +import ScreenWrapper from '../../../components/ScreenWrapper'; const propTypes = { /** The credentials of the logged in person */ @@ -39,19 +42,32 @@ function SAMLSignInPage({credentials}) { [credentials.login], ); return ( - } - onNavigationStateChange={handleNavigationStateChange} - /> + + Navigation.navigate(ROUTES.HOME)} + /> + + } + onNavigationStateChange={handleNavigationStateChange} + /> + + ); } SAMLSignInPage.propTypes = propTypes; SAMLSignInPage.defaultProps = defaultProps; +SAMLSignInPage.displayName = "SAMLSignInPage" export default withOnyx({ credentials: {key: ONYXKEYS.CREDENTIALS}, From 544ff27b3c573c3031dc82558c9e442ea297ac2c Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 25 Oct 2023 18:35:58 -0700 Subject: [PATCH 10/23] fix imports --- src/pages/signin/SAMLSignInPage/index.native.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 82d353680605..99384e5fe44a 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -10,6 +10,8 @@ import getPlatform from '../../../libs/getPlatform'; import FullPageOfflineBlockingView from '../../../components/BlockingViews/FullPageOfflineBlockingView'; import HeaderWithBackButton from '../../../components/HeaderWithBackButton'; import ScreenWrapper from '../../../components/ScreenWrapper'; +import Navigation from '../../../libs/Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; const propTypes = { /** The credentials of the logged in person */ From 7073d9310f5ebbb87a17f9f6bae247e30877da40 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Wed, 25 Oct 2023 18:36:53 -0700 Subject: [PATCH 11/23] fix redirect flickering when pressing go back after choosing magic code --- src/pages/signin/SignInPage.js | 7 ++++++- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 9f3bfbfece1c..6a568f059565 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -155,6 +155,12 @@ function SignInPage({credentials, account, isInModal, activeClients, preferredLo } App.setLocale(Localize.getDevicePreferredLocale()); }, [preferredLocale]); + useEffect(() => { + // If we don't have a login set, reset the user's login preference (SSO or magic code) + if (!credentials.login && isUsingMagicCode) { + setIsUsingMagicCode(false); + } + }, [credentials.login, isUsingMagicCode, setIsUsingMagicCode]) const { shouldShowLoginForm, @@ -249,7 +255,6 @@ function SignInPage({credentials, account, isInModal, activeClients, preferredLo )} {shouldShowUnlinkLoginForm && } diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js index dc100fffe4f1..35853faa3c0b 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js @@ -70,9 +70,6 @@ const propTypes = { /** Function to change `isUsingRecoveryCode` state when user toggles between 2fa code and recovery code */ setIsUsingRecoveryCode: PropTypes.func.isRequired, - /** Function to change `isUsingMagicCode` state when the user goes back to the login page */ - setIsUsingMagicCode: PropTypes.func.isRequired, - ...withLocalizePropTypes, }; @@ -209,7 +206,6 @@ function BaseValidateCodeForm(props) { */ const clearSignInData = () => { // Reset the user's preference for signing in with SAML versus magic codes - props.setIsUsingMagicCode(false); clearLocalSignInData(); Session.clearSignInData(); }; From 4586feef26a31b7fb18d95eead7f20daf1a17268 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Thu, 26 Oct 2023 10:57:15 -0700 Subject: [PATCH 12/23] reset sign in data if going back from SSO provider page --- src/pages/signin/SAMLSignInPage/index.native.js | 5 ++++- src/pages/signin/SignInPage.js | 12 +++++++++--- .../signin/ValidateCodeForm/BaseValidateCodeForm.js | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 99384e5fe44a..60c41414174f 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -51,7 +51,10 @@ function SAMLSignInPage({credentials}) { > Navigation.navigate(ROUTES.HOME)} + onBackButtonPress={() => { + Session.clearSignInData(); + Navigation.navigate(ROUTES.HOME); + }} /> { - // If we don't have a login set, reset the user's login preference (SSO or magic code) - if (!credentials.login && isUsingMagicCode) { + // If we don't have a login set, reset the user's SAML login preferences + if (!credentials.login) { + if (isUsingMagicCode) { setIsUsingMagicCode(false); + } + if (hasInitiatedSAMLLogin) { + setHasInitiatedSAMLLogin(false); + } } - }, [credentials.login, isUsingMagicCode, setIsUsingMagicCode]) + + }, [credentials.login, isUsingMagicCode, setIsUsingMagicCode, hasInitiatedSAMLLogin, setHasInitiatedSAMLLogin]) const { shouldShowLoginForm, diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js index 35853faa3c0b..0433a24db6e0 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js @@ -205,7 +205,6 @@ function BaseValidateCodeForm(props) { * Clears local and Onyx sign in states */ const clearSignInData = () => { - // Reset the user's preference for signing in with SAML versus magic codes clearLocalSignInData(); Session.clearSignInData(); }; From 4dd5f559ad7f9630b3081fc4216df05803fdc74f Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Thu, 26 Oct 2023 18:16:12 -0700 Subject: [PATCH 13/23] style --- src/pages/signin/SAMLSignInPage/index.native.js | 2 +- src/pages/signin/SignInPage.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 60c41414174f..fa823ec9a01b 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -72,7 +72,7 @@ function SAMLSignInPage({credentials}) { SAMLSignInPage.propTypes = propTypes; SAMLSignInPage.defaultProps = defaultProps; -SAMLSignInPage.displayName = "SAMLSignInPage" +SAMLSignInPage.displayName = 'SAMLSignInPage'; export default withOnyx({ credentials: {key: ONYXKEYS.CREDENTIALS}, diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index e33e2df88563..81ada5a99790 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -156,17 +156,18 @@ function SignInPage({credentials, account, isInModal, activeClients, preferredLo App.setLocale(Localize.getDevicePreferredLocale()); }, [preferredLocale]); useEffect(() => { + if (credentials.login) { + return; + } + // If we don't have a login set, reset the user's SAML login preferences - if (!credentials.login) { - if (isUsingMagicCode) { + if (isUsingMagicCode) { setIsUsingMagicCode(false); - } - if (hasInitiatedSAMLLogin) { - setHasInitiatedSAMLLogin(false); - } } - - }, [credentials.login, isUsingMagicCode, setIsUsingMagicCode, hasInitiatedSAMLLogin, setHasInitiatedSAMLLogin]) + if (hasInitiatedSAMLLogin) { + setHasInitiatedSAMLLogin(false); + } + }, [credentials.login, isUsingMagicCode, setIsUsingMagicCode, hasInitiatedSAMLLogin, setHasInitiatedSAMLLogin]); const { shouldShowLoginForm, From 14818b737ba60d5cf3ca5b206d16174ef150dbd9 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 30 Oct 2023 10:14:05 -0700 Subject: [PATCH 14/23] add in error handling from App/pull/30027 --- src/pages/signin/SAMLSignInPage/index.native.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index fa823ec9a01b..e6ed33710b24 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -40,6 +40,12 @@ function SAMLSignInPage({credentials}) { const shortLivedAuthToken = searchParams.get('shortLivedAuthToken'); Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken); } + + if (searchParams.has('error')) { + // Run the Onyx action to set an error state on the sign in page + // Currently this is what's going to trigger because the backend isn't redirecting SAML correctly + Navigation.navigate(ROUTES.HOME); + } }, [credentials.login], ); From ed660094b8a25e095eef055d40692dc98b5acdc1 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 30 Oct 2023 10:44:14 -0700 Subject: [PATCH 15/23] update imports --- src/components/SAMLLoadingIndicator.js | 14 ++++++------- src/pages/signin/SAMLSignInPage/index.js | 2 +- .../signin/SAMLSignInPage/index.native.js | 20 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/SAMLLoadingIndicator.js b/src/components/SAMLLoadingIndicator.js index 1169436e79e5..e6171838e0ff 100644 --- a/src/components/SAMLLoadingIndicator.js +++ b/src/components/SAMLLoadingIndicator.js @@ -1,12 +1,12 @@ import React from 'react'; import {View, StyleSheet} from 'react-native'; -import styles from '../styles/styles'; -import themeColors from '../styles/themes/default'; -import Icon from './Icon'; -import Text from './Text'; -import * as Expensicons from './Icon/Expensicons'; -import * as Illustrations from './Icon/Illustrations'; -import useLocalize from '../hooks/useLocalize'; +import styles from '@styles/styles'; +import themeColors from '@styles/themes/default'; +import Icon from '@components/Icon'; +import Text from '@components/Text'; +import * as Expensicons from '@components/Icon/Expensicons'; +import * as Illustrations from '@components/Icon/Illustrations'; +import useLocalize from '@hooks/useLocalize'; function SAMLLoadingIndicator() { const {translate} = useLocalize(); diff --git a/src/pages/signin/SAMLSignInPage/index.js b/src/pages/signin/SAMLSignInPage/index.js index 6a4fdef80848..cfef9553f868 100644 --- a/src/pages/signin/SAMLSignInPage/index.js +++ b/src/pages/signin/SAMLSignInPage/index.js @@ -3,7 +3,7 @@ import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import CONFIG from '@src/CONFIG'; import ONYXKEYS from '@src/ONYXKEYS'; -import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; +import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; const propTypes = { diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index e6ed33710b24..9a75508b10c5 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -2,16 +2,16 @@ import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import WebView from 'react-native-webview'; -import ONYXKEYS from '../../../ONYXKEYS'; -import CONFIG from '../../../CONFIG'; -import * as Session from '../../../libs/actions/Session'; -import SAMLLoadingIndicator from '../../../components/SAMLLoadingIndicator'; -import getPlatform from '../../../libs/getPlatform'; -import FullPageOfflineBlockingView from '../../../components/BlockingViews/FullPageOfflineBlockingView'; -import HeaderWithBackButton from '../../../components/HeaderWithBackButton'; -import ScreenWrapper from '../../../components/ScreenWrapper'; -import Navigation from '../../../libs/Navigation/Navigation'; -import ROUTES from '../../../ROUTES'; +import ONYXKEYS from '@src/ONYXKEYS'; +import CONFIG from '@src/CONFIG'; +import ROUTES from '@src/ROUTES'; +import * as Session from '@userActions/Session'; +import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; +import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import ScreenWrapper from '@components/ScreenWrapper'; +import Navigation from '@libs/Navigation/Navigation'; +import getPlatform from '@libs/getPlatform'; const propTypes = { /** The credentials of the logged in person */ From b247558ef7889846c109cdbf3b0e698a39c640fa Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 30 Oct 2023 11:39:48 -0700 Subject: [PATCH 16/23] prettier --- src/components/SAMLLoadingIndicator.js | 12 ++++++------ src/pages/signin/SAMLSignInPage/index.js | 5 ++--- src/pages/signin/SAMLSignInPage/index.native.js | 14 +++++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/components/SAMLLoadingIndicator.js b/src/components/SAMLLoadingIndicator.js index e6171838e0ff..d00c5a032a72 100644 --- a/src/components/SAMLLoadingIndicator.js +++ b/src/components/SAMLLoadingIndicator.js @@ -1,12 +1,12 @@ import React from 'react'; -import {View, StyleSheet} from 'react-native'; +import {StyleSheet, View} from 'react-native'; +import useLocalize from '@hooks/useLocalize'; import styles from '@styles/styles'; import themeColors from '@styles/themes/default'; -import Icon from '@components/Icon'; -import Text from '@components/Text'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import useLocalize from '@hooks/useLocalize'; +import Icon from './Icon'; +import * as Expensicons from './Icon/Expensicons'; +import * as Illustrations from './Icon/Illustrations'; +import Text from './Text'; function SAMLLoadingIndicator() { const {translate} = useLocalize(); diff --git a/src/pages/signin/SAMLSignInPage/index.js b/src/pages/signin/SAMLSignInPage/index.js index cfef9553f868..782ed4e0da27 100644 --- a/src/pages/signin/SAMLSignInPage/index.js +++ b/src/pages/signin/SAMLSignInPage/index.js @@ -1,10 +1,9 @@ +import PropTypes from 'prop-types'; import React, {useEffect} from 'react'; import {withOnyx} from 'react-native-onyx'; -import PropTypes from 'prop-types'; +import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; import CONFIG from '@src/CONFIG'; import ONYXKEYS from '@src/ONYXKEYS'; -import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; - const propTypes = { /** The credentials of the logged in person */ diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 9a75508b10c5..9cf546d94313 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -1,17 +1,17 @@ +import PropTypes from 'prop-types'; import React, {useCallback} from 'react'; import {withOnyx} from 'react-native-onyx'; -import PropTypes from 'prop-types'; import WebView from 'react-native-webview'; -import ONYXKEYS from '@src/ONYXKEYS'; -import CONFIG from '@src/CONFIG'; -import ROUTES from '@src/ROUTES'; -import * as Session from '@userActions/Session'; -import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator'; import ScreenWrapper from '@components/ScreenWrapper'; -import Navigation from '@libs/Navigation/Navigation'; import getPlatform from '@libs/getPlatform'; +import Navigation from '@libs/Navigation/Navigation'; +import * as Session from '@userActions/Session'; +import CONFIG from '@src/CONFIG'; +import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; const propTypes = { /** The credentials of the logged in person */ From 380fa265b01e32290041e773f16a96f551e5149d Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Mon, 30 Oct 2023 16:54:27 -0700 Subject: [PATCH 17/23] remove navigation after callback --- src/pages/signin/SAMLSignInPage/index.native.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 9cf546d94313..58e3f53cd746 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React, {useCallback} from 'react'; +import React, {useCallback, useState} from 'react'; import {withOnyx} from 'react-native-onyx'; import WebView from 'react-native-webview'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; @@ -27,6 +27,7 @@ const defaultProps = { function SAMLSignInPage({credentials}) { const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}&platform=${getPlatform()}`; + const [showNavigation, shouldShowNavigation] = useState(true); /** * Handles in-app navigation once we get a response back from Expensify @@ -35,6 +36,11 @@ function SAMLSignInPage({credentials}) { */ const handleNavigationStateChange = useCallback( ({url}) => { + // If we've gotten a callback then remove the option to navigate back to the sign in page + if (url.includes('loginCallback')) { + shouldShowNavigation(false); + } + const searchParams = new URLSearchParams(new URL(url).search); if (searchParams.has('shortLivedAuthToken')) { const shortLivedAuthToken = searchParams.get('shortLivedAuthToken'); @@ -47,14 +53,16 @@ function SAMLSignInPage({credentials}) { Navigation.navigate(ROUTES.HOME); } }, - [credentials.login], + [credentials.login, shouldShowNavigation], ); + return ( + {showNavigation && ( { @@ -62,6 +70,7 @@ function SAMLSignInPage({credentials}) { Navigation.navigate(ROUTES.HOME); }} /> + )} Date: Thu, 2 Nov 2023 14:59:38 -0700 Subject: [PATCH 18/23] style --- .../signin/SAMLSignInPage/index.native.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 58e3f53cd746..8b765ecc1d32 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -62,15 +62,15 @@ function SAMLSignInPage({credentials}) { includeSafeAreaPaddingBottom={false} testID={SAMLSignInPage.displayName} > - {showNavigation && ( - { - Session.clearSignInData(); - Navigation.navigate(ROUTES.HOME); - }} - /> - )} + {showNavigation && ( + { + Session.clearSignInData(); + Navigation.navigate(ROUTES.HOME); + }} + /> + )} Date: Thu, 16 Nov 2023 16:05:06 -0800 Subject: [PATCH 19/23] update error handing to set account error message --- src/pages/signin/SAMLSignInPage/index.native.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 8b765ecc1d32..b1e67ef4d14a 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -47,9 +47,9 @@ function SAMLSignInPage({credentials}) { Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken); } - if (searchParams.has('error')) { - // Run the Onyx action to set an error state on the sign in page - // Currently this is what's going to trigger because the backend isn't redirecting SAML correctly + // If the login attempt is unsuccessful, set the error message for the account and redirect to sign in page + if (searchParams.has('error')) {; + Session.setAccountError(searchParams.get('error')); Navigation.navigate(ROUTES.HOME); } }, From 79e89c223884c141f3c624d8971def232466ce0b Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Thu, 16 Nov 2023 18:15:06 -0800 Subject: [PATCH 20/23] return early when we've already initiated saml login --- src/pages/signin/SAMLSignInPage/index.native.js | 2 +- src/pages/signin/SignInPage.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index b1e67ef4d14a..094592e681d4 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -48,7 +48,7 @@ function SAMLSignInPage({credentials}) { } // If the login attempt is unsuccessful, set the error message for the account and redirect to sign in page - if (searchParams.has('error')) {; + if (searchParams.has('error')) { Session.setAccountError(searchParams.get('error')); Navigation.navigate(ROUTES.HOME); } diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 68c793e49dad..ce70e548dfe3 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -192,6 +192,9 @@ function SignInPage({credentials, account, isInModal, activeClients, preferredLo if (shouldInitiateSAMLLogin) { setHasInitiatedSAMLLogin(true); Navigation.isNavigationReady().then(() => Navigation.navigate(ROUTES.SAML_SIGN_IN)); + } else if (hasInitiatedSAMLLogin) { + // Return early because we're already navigating to a different page + return; } let welcomeHeader = ''; From 0ebfd25800a66195aee0febcd5c1fc54aceda5f7 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 28 Nov 2023 13:46:31 -1000 Subject: [PATCH 21/23] showLoginForm when error is returned during SAML login --- src/pages/signin/SignInPage.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index c8d8ed15e417..0d62fa3c904f 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -111,7 +111,7 @@ function getRenderOptions({hasLogin, hasValidateCode, account, isPrimaryLogin, i Session.clearSignInData(); } - const shouldShowLoginForm = isClientTheLeader && !hasLogin && !hasValidateCode; + const shouldShowLoginForm = (isClientTheLeader && !hasLogin && !hasValidateCode) || (hasInitiatedSAMLLogin && !_.isEmpty(account.errors)); const shouldShowEmailDeliveryFailurePage = hasLogin && hasEmailDeliveryFailure && !shouldShowChooseSSOOrMagicCode && !shouldInitiateSAMLLogin; const isUnvalidatedSecondaryLogin = hasLogin && !isPrimaryLogin && !account.validated && !hasEmailDeliveryFailure; const shouldShowValidateCodeForm = @@ -194,9 +194,6 @@ function SignInPageInner({credentials, account, isInModal, activeClients, prefer if (shouldInitiateSAMLLogin) { setHasInitiatedSAMLLogin(true); Navigation.isNavigationReady().then(() => Navigation.navigate(ROUTES.SAML_SIGN_IN)); - } else if (hasInitiatedSAMLLogin) { - // Return early because we're already navigating to a different page - return; } let welcomeHeader = ''; @@ -238,7 +235,7 @@ function SignInPageInner({credentials, account, isInModal, activeClients, prefer if (shouldShowEmailDeliveryFailurePage || shouldShowChooseSSOOrMagicCode) { welcomeText = ''; } - } else if (!shouldInitiateSAMLLogin) { + } else if (!shouldInitiateSAMLLogin && !hasInitiatedSAMLLogin) { Log.warn('SignInPage in unexpected state!'); } From 4a020dec05bac0185ff029650826fdf40f52cc9b Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 28 Nov 2023 14:12:11 -1000 Subject: [PATCH 22/23] clear signin data after recieving error --- src/pages/signin/SAMLSignInPage/index.native.js | 1 + src/pages/signin/SignInPage.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/signin/SAMLSignInPage/index.native.js b/src/pages/signin/SAMLSignInPage/index.native.js index 094592e681d4..502e26e337b9 100644 --- a/src/pages/signin/SAMLSignInPage/index.native.js +++ b/src/pages/signin/SAMLSignInPage/index.native.js @@ -49,6 +49,7 @@ function SAMLSignInPage({credentials}) { // If the login attempt is unsuccessful, set the error message for the account and redirect to sign in page if (searchParams.has('error')) { + Session.clearSignInData(); Session.setAccountError(searchParams.get('error')); Navigation.navigate(ROUTES.HOME); } diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 0d62fa3c904f..1efab943d33d 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -111,7 +111,7 @@ function getRenderOptions({hasLogin, hasValidateCode, account, isPrimaryLogin, i Session.clearSignInData(); } - const shouldShowLoginForm = (isClientTheLeader && !hasLogin && !hasValidateCode) || (hasInitiatedSAMLLogin && !_.isEmpty(account.errors)); + const shouldShowLoginForm = isClientTheLeader && !hasLogin && !hasValidateCode; const shouldShowEmailDeliveryFailurePage = hasLogin && hasEmailDeliveryFailure && !shouldShowChooseSSOOrMagicCode && !shouldInitiateSAMLLogin; const isUnvalidatedSecondaryLogin = hasLogin && !isPrimaryLogin && !account.validated && !hasEmailDeliveryFailure; const shouldShowValidateCodeForm = From 5c8519f4483f40629ac77065be39197cf1b47186 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Thu, 30 Nov 2023 18:10:17 -0800 Subject: [PATCH 23/23] remove unused onyxkey import --- src/pages/LogInWithShortLivedAuthTokenPage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/LogInWithShortLivedAuthTokenPage.js b/src/pages/LogInWithShortLivedAuthTokenPage.js index 8534961b3337..16d0c3909d62 100644 --- a/src/pages/LogInWithShortLivedAuthTokenPage.js +++ b/src/pages/LogInWithShortLivedAuthTokenPage.js @@ -125,5 +125,4 @@ LogInWithShortLivedAuthTokenPage.displayName = 'LogInWithShortLivedAuthTokenPage export default withOnyx({ account: {key: ONYXKEYS.ACCOUNT}, - session: {key: ONYXKEYS.SESSION}, })(LogInWithShortLivedAuthTokenPage);