diff --git a/src/ROUTES.js b/src/ROUTES.js
index 71206888801b..02880a5adad9 100644
--- a/src/ROUTES.js
+++ b/src/ROUTES.js
@@ -66,16 +66,10 @@ export default {
) => `r/${reportID}/participants/details?login=${encodeURIComponent(login)}`,
REPORT_WITH_ID_DETAILS: 'r/:reportID/details',
getReportDetailsRoute: reportID => `r/${reportID}/details`,
- VALIDATE_LOGIN: 'v',
- VALIDATE_LOGIN_WITH_VALIDATE_CODE: 'v/:accountID/:validateCode',
LOGIN_WITH_SHORT_LIVED_TOKEN: 'transition',
// This is a special validation URL that will take the user to /workspace/new after validation. This is used
// when linking users from e.com in order to share a session in this app.
- LOGIN_WITH_VALIDATE_CODE_NEW_WORKSPACE: 'v/:accountID/:validateCode/new-workspace',
- LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE: 'v/:accountID/:validateCode/2fa/new-workspace',
- LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD: 'v/:accountID/:validateCode/workspace/:policyID/card',
- LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD: 'v/:accountID/:validateCode/2fa/workspace/:policyID/card',
ENABLE_PAYMENTS: 'enable-payments',
WORKSPACE_NEW: 'workspace/new',
WORKSPACE_INITIAL: 'workspace/:policyID',
diff --git a/src/SCREENS.js b/src/SCREENS.js
index 3a9754a1ee76..7b92986721a4 100644
--- a/src/SCREENS.js
+++ b/src/SCREENS.js
@@ -7,8 +7,4 @@ export default {
LOADING: 'Loading',
REPORT: 'Report',
LOG_IN_WITH_SHORT_LIVED_TOKEN: 'LogInWithShortLivedToken',
- LOGIN_WITH_VALIDATE_CODE_NEW_WORKSPACE: 'LoginWithValidateCodeNewWorkspace',
- LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE: 'LoginWithValidateCode2FANewWorkspace',
- LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD: 'LoginWithValidateCodeWorkspaceCard',
- LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD: 'LoginWithValidateCode2FAWorkspaceCard',
};
diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.js b/src/libs/Navigation/AppNavigator/AuthScreens.js
index 10f22a0ca3cd..b830f0027940 100644
--- a/src/libs/Navigation/AppNavigator/AuthScreens.js
+++ b/src/libs/Navigation/AppNavigator/AuthScreens.js
@@ -38,9 +38,6 @@ import {fetchFreePlanVerifiedBankAccount} from '../../actions/BankAccounts';
// Main drawer navigator
import MainDrawerNavigator from './MainDrawerNavigator';
-// Validate login page
-import ValidateLoginPage from '../../../pages/ValidateLoginPage';
-
// Modal Stack Navigators
import {
IOUBillStackNavigator,
@@ -271,14 +268,6 @@ class AuthScreens extends React.Component {
}}
component={MainDrawerNavigator}
/>
- (
options={defaultScreenOptions}
component={LogInWithShortLivedTokenPage}
/>
-
-
-
-
-
);
diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js
index a9a4fd1ceb9f..60c8fdf3df91 100644
--- a/src/libs/Navigation/linkingConfig.js
+++ b/src/libs/Navigation/linkingConfig.js
@@ -27,11 +27,6 @@ export default {
// Main Routes
SetPassword: ROUTES.SET_PASSWORD_WITH_VALIDATE_CODE,
- ValidateLogin: ROUTES.VALIDATE_LOGIN_WITH_VALIDATE_CODE,
- [SCREENS.LOGIN_WITH_VALIDATE_CODE_NEW_WORKSPACE]: ROUTES.LOGIN_WITH_VALIDATE_CODE_NEW_WORKSPACE,
- [SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE]: ROUTES.LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE,
- [SCREENS.LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD]: ROUTES.LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD,
- [SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD]: ROUTES.LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD,
[SCREENS.LOG_IN_WITH_SHORT_LIVED_TOKEN]: ROUTES.LOGIN_WITH_SHORT_LIVED_TOKEN,
// Modal Screens
diff --git a/src/pages/LoginWithValidateCode2FAPage.js b/src/pages/LoginWithValidateCode2FAPage.js
deleted file mode 100644
index 5484242544d7..000000000000
--- a/src/pages/LoginWithValidateCode2FAPage.js
+++ /dev/null
@@ -1,186 +0,0 @@
-import React, {Component} from 'react';
-import {TextInput, View} from 'react-native';
-import lodashGet from 'lodash/get';
-import PropTypes from 'prop-types';
-import {withOnyx} from 'react-native-onyx';
-import withLocalize, {withLocalizePropTypes} from '../components/withLocalize';
-import validateLinkPropTypes from './validateLinkPropTypes';
-import {continueSessionFromECom} from '../libs/actions/Session';
-import styles from '../styles/styles';
-import ExpensifyCashLogo from '../components/ExpensifyCashLogo';
-import variables from '../styles/variables';
-import themeColors from '../styles/themes/default';
-import CONST from '../CONST';
-import Button from '../components/Button';
-import Text from '../components/Text';
-import compose from '../libs/compose';
-import ONYXKEYS from '../ONYXKEYS';
-import Navigation from '../libs/Navigation/Navigation';
-import ROUTES from '../ROUTES';
-import SCREENS from '../SCREENS';
-import * as Policy from '../libs/actions/Policy';
-import Permissions from '../libs/Permissions';
-import FullScreenLoadingIndicator from '../components/FullscreenLoadingIndicator';
-
-const propTypes = {
- /* Onyx Props */
-
- /** The data about the current session */
- session: PropTypes.shape({
- /** The authToken for the current session */
- authToken: PropTypes.string,
- }),
-
- /** The route name, accountID, and validateCode are passed via the URL */
- route: validateLinkPropTypes,
-
- /** List of betas */
- betas: PropTypes.arrayOf(PropTypes.string),
-
- ...withLocalizePropTypes,
-};
-
-const defaultProps = {
- route: {
- params: {},
- },
- session: {},
- betas: [],
-};
-class LoginWithValidateCode2FAPage extends Component {
- constructor(props) {
- super(props);
-
- this.validateAndSubmitForm = this.validateAndSubmitForm.bind(this);
-
- this.state = {
- twoFactorAuthCode: '',
- formError: false,
- loading: false,
- };
- }
-
- componentDidMount() {
- // If the user has an active session already, they need to be redirected straight to the relevant page
- if (this.props.session.authToken) {
- // In order to navigate to a modal, we first have to dismiss the current modal. But there is no current
- // modal you say? I know, it confuses me too. Without dismissing the current modal, if the user cancels out
- // of the new workspace modal, then they will be routed back to
- // /v///workspace/123/card and we don't want that. We want them to go back to `/`
- // and by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/`
- // if they cancel out of the new workspace modal.
- Navigation.dismissModal();
- if (Permissions.canUseFreePlan(this.props.betas)) {
- this.rerouteToRelevantPage();
- }
- }
- }
-
- componentDidUpdate() {
- // Betas can be loaded a little after a user is authenticated, so check again if the betas have been updated
- if (this.props.session.authToken && Permissions.canUseFreePlan(this.props.betas)) {
- this.rerouteToRelevantPage();
- }
- }
-
- rerouteToRelevantPage() {
- // Since all 2FA validate code login routes lead to this component, redirect to the appropriate page based on
- // the original route.
- switch (this.props.route.name) {
- case SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_WORKSPACE_CARD:
- Navigation.navigate(ROUTES.getWorkspaceCardRoute(this.props.route.params.policyID));
- break;
-
- case SCREENS.LOGIN_WITH_VALIDATE_CODE_2FA_NEW_WORKSPACE:
- // Creating a policy will reroute the user to the settings page afterwards
- Policy.create();
- break;
-
- default:
- Navigation.navigate(ROUTES.HOME);
- break;
- }
- }
-
- validateAndSubmitForm() {
- if (!this.state.twoFactorAuthCode.trim()) {
- this.setState({formError: this.props.translate('passwordForm.pleaseFillOutAllFields')});
- return;
- }
-
- this.setState({
- formError: null,
- loading: true,
- });
-
- const accountID = lodashGet(this.props.route.params, 'accountID', '');
- const validateCode = lodashGet(this.props.route.params, 'validateCode', '');
- continueSessionFromECom(accountID, validateCode, this.state.twoFactorAuthCode);
- }
-
- render() {
- // Show a loader so that the user isn't immediately kicked to the home page before rerouteToRelevantPage runs
- if (this.props.session.authToken) {
- return ;
- }
-
- return (
-
-
-
-
-
-
- {this.props.translate('signInPage.expensifyDotCash')}
-
-
-
-
-
-
- {this.props.translate('passwordForm.enterYourTwoFactorAuthenticationCodeToContinue')}
-
- this.setState({twoFactorAuthCode: text})}
- onSubmitEditing={this.validateAndSubmitForm}
- keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
- />
-
-
-
-
- {this.state.formError && (
-
- {this.state.formError}
-
- )}
-
-
- );
- }
-}
-
-LoginWithValidateCode2FAPage.propTypes = propTypes;
-LoginWithValidateCode2FAPage.defaultProps = defaultProps;
-
-export default compose(
- withLocalize,
- withOnyx({
- session: {
- key: ONYXKEYS.SESSION,
- },
- betas: {
- key: ONYXKEYS.BETAS,
- },
- }),
-)(LoginWithValidateCode2FAPage);
diff --git a/src/pages/LoginWithValidateCodePage.js b/src/pages/LoginWithValidateCodePage.js
deleted file mode 100644
index c01fcbcc52e2..000000000000
--- a/src/pages/LoginWithValidateCodePage.js
+++ /dev/null
@@ -1,105 +0,0 @@
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {withOnyx} from 'react-native-onyx';
-import lodashGet from 'lodash/get';
-import validateLinkPropTypes from './validateLinkPropTypes';
-import compose from '../libs/compose';
-import ONYXKEYS from '../ONYXKEYS';
-import Navigation from '../libs/Navigation/Navigation';
-import ROUTES from '../ROUTES';
-import SCREENS from '../SCREENS';
-import {continueSessionFromECom} from '../libs/actions/Session';
-import * as Policy from '../libs/actions/Policy';
-import Permissions from '../libs/Permissions';
-import FullScreenLoadingIndicator from '../components/FullscreenLoadingIndicator';
-
-const propTypes = {
- /* Onyx Props */
-
- /** The data about the current session */
- session: PropTypes.shape({
- /** The authToken for the current session */
- authToken: PropTypes.string,
- }),
-
- /** The accountID and validateCode are passed via the URL */
- route: validateLinkPropTypes,
-
- /** List of betas */
- betas: PropTypes.arrayOf(PropTypes.string),
-};
-
-const defaultProps = {
- route: {
- params: {},
- },
- session: {},
- betas: [],
-};
-class LoginWithValidateCodePage extends Component {
- componentDidMount() {
- // If the user has an active session already, they need to be redirected straight to the relevant page
- if (this.props.session.authToken) {
- // In order to navigate to a modal, we first have to dismiss the current modal. But there is no current
- // modal you say? I know, it confuses me too. Without dismissing the current modal, if the user cancels out
- // of the new workspace modal, then they will be routed back to
- // /v///workspace/123/card and we don't want that. We want them to go back to `/`
- // and by calling dismissModal(), the /v/... route is removed from history so the user will get taken to `/`
- // if they cancel out of the new workspace modal.
- Navigation.dismissModal();
- if (Permissions.canUseFreePlan(this.props.betas)) {
- this.rerouteToRelevantPage();
- }
- return;
- }
-
- const accountID = lodashGet(this.props.route.params, 'accountID', '');
- const validateCode = lodashGet(this.props.route.params, 'validateCode', '');
- continueSessionFromECom(accountID, validateCode);
- }
-
- componentDidUpdate() {
- // Betas can be loaded a little after a user is authenticated, so check again if the betas have been updated
- if (this.props.session.authToken && Permissions.canUseFreePlan(this.props.betas)) {
- this.rerouteToRelevantPage();
- }
- }
-
- rerouteToRelevantPage() {
- // Since all validate code login routes lead to this component, redirect to the appropriate page based on
- // the original route.
- switch (this.props.route.name) {
- case SCREENS.LOGIN_WITH_VALIDATE_CODE_WORKSPACE_CARD:
- Navigation.navigate(ROUTES.getWorkspaceCardRoute(this.props.route.params.policyID));
- break;
-
- case SCREENS.LOGIN_WITH_VALIDATE_CODE_NEW_WORKSPACE:
- // Creating a policy will reroute the user to the settings page afterwards
- Policy.create();
- break;
-
- default:
- Navigation.navigate(ROUTES.HOME);
- break;
- }
- }
-
- render() {
- // Show a loader so that the user isn't immediately kicked to the home page before rerouteToRelevantPage runs
- return ;
- }
-}
-
-LoginWithValidateCodePage.propTypes = propTypes;
-LoginWithValidateCodePage.defaultProps = defaultProps;
-
-export default compose(
- withOnyx({
- session: {
- key: ONYXKEYS.SESSION,
- },
- betas: {
- key: ONYXKEYS.BETAS,
- },
- }),
-)(LoginWithValidateCodePage);
diff --git a/src/pages/SetPasswordPage.js b/src/pages/SetPasswordPage.js
index 01060fc159a8..8e934e76b178 100755
--- a/src/pages/SetPasswordPage.js
+++ b/src/pages/SetPasswordPage.js
@@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import lodashGet from 'lodash/get';
-import validateLinkPropTypes from './validateLinkPropTypes';
import styles from '../styles/styles';
import {setPassword, signIn} from '../libs/actions/Session';
import ONYXKEYS from '../ONYXKEYS';
@@ -42,7 +41,22 @@ const propTypes = {
}),
/** The accountID and validateCode are passed via the URL */
- route: validateLinkPropTypes,
+ route: PropTypes.shape({
+ // The name of the route
+ name: PropTypes.string,
+
+ // Unique key associated with the route
+ key: PropTypes.string,
+
+ // Each parameter passed via the URL
+ params: PropTypes.shape({
+ // AccountID associated with the validation link
+ accountID: PropTypes.string,
+
+ // Validation code associated with the validation link
+ validateCode: PropTypes.string,
+ }),
+ }),
...withLocalizePropTypes,
};
diff --git a/src/pages/ValidateLoginPage.js b/src/pages/ValidateLoginPage.js
deleted file mode 100644
index a5ce335c4b02..000000000000
--- a/src/pages/ValidateLoginPage.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import {Component} from 'react';
-import lodashGet from 'lodash/get';
-import validateLinkPropTypes from './validateLinkPropTypes';
-import {validateLogin} from '../libs/actions/User';
-
-const propTypes = {
- /* Onyx Props */
-
- /** The accountID and validateCode are passed via the URL */
- route: validateLinkPropTypes,
-};
-
-const defaultProps = {
- route: {
- params: {},
- },
-};
-class ValidateLoginPage extends Component {
- componentDidMount() {
- const accountID = lodashGet(this.props.route.params, 'accountID', '');
- const validateCode = lodashGet(this.props.route.params, 'validateCode', '');
-
- validateLogin(accountID, validateCode);
- }
-
- render() {
- // Don't render anything here since we will redirect the user once we've attempted to validate their login
- return null;
- }
-}
-
-ValidateLoginPage.propTypes = propTypes;
-ValidateLoginPage.defaultProps = defaultProps;
-
-export default ValidateLoginPage;
diff --git a/src/pages/validateLinkPropTypes.js b/src/pages/validateLinkPropTypes.js
deleted file mode 100644
index 399420f5e584..000000000000
--- a/src/pages/validateLinkPropTypes.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import PropTypes from 'prop-types';
-
-export default PropTypes.shape({
- // The name of the route
- name: PropTypes.string,
-
- // Unique key associated with the route
- key: PropTypes.string,
-
- // Each parameter passed via the URL
- params: PropTypes.shape({
- // AccountID associated with the validation link
- accountID: PropTypes.string,
-
- // Validation code associated with the validation link
- validateCode: PropTypes.string,
- }),
-});