diff --git a/src/pages/ValidateLoginPage/index.js b/src/pages/ValidateLoginPage/index.js index a82279cc69e9..561c8512ca3d 100644 --- a/src/pages/ValidateLoginPage/index.js +++ b/src/pages/ValidateLoginPage/index.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; import {propTypes as validateLinkPropTypes, defaultProps as validateLinkDefaultProps} from './validateLinkPropTypes'; -import * as User from '../../libs/actions/User'; import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator'; import ONYXKEYS from '../../ONYXKEYS'; import * as Session from '../../libs/actions/Session'; @@ -39,21 +38,15 @@ function ValidateLoginPage(props) { const {preferredLocale} = useLocalize(); useEffect(() => { - const login = lodashGet(props, 'credentials.login', null); const accountID = lodashGet(props.route.params, 'accountID', ''); const validateCode = lodashGet(props.route.params, 'validateCode', ''); - // A fresh session will not have credentials.login available. - if (!login) { - if (lodashGet(props, '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. - Navigation.goBack(false); - } else { - Session.signInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale); - } + if (lodashGet(props, '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. + Navigation.goBack(false); } else { - User.validateLogin(accountID, validateCode); + Session.signInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); diff --git a/src/pages/ValidateLoginPage/index.website.js b/src/pages/ValidateLoginPage/index.website.js index f0787fa163e9..57b7cf4471c5 100644 --- a/src/pages/ValidateLoginPage/index.website.js +++ b/src/pages/ValidateLoginPage/index.website.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; import {propTypes as validateLinkPropTypes, defaultProps as validateLinkDefaultProps} from './validateLinkPropTypes'; -import * as User from '../../libs/actions/User'; import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator'; import ValidateCodeModal from '../../components/ValidateCode/ValidateCodeModal'; import ONYXKEYS from '../../ONYXKEYS'; @@ -61,12 +60,6 @@ function ValidateLoginPage(props) { const cachedAccountID = lodashGet(props, 'credentials.accountID', null); useEffect(() => { - // A fresh session will not have credentials.login - if (login) { - User.validateLogin(accountID, validateCode); - return; - } - 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.navigate(ROUTES.REPORT);