Skip to content

Commit

Permalink
remove incorrect validate login logic that's breaking magic links
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkiWines committed Jul 25, 2023
1 parent 607e7e9 commit 4cfa895
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
17 changes: 5 additions & 12 deletions src/pages/ValidateLoginPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
}, []);
Expand Down
5 changes: 0 additions & 5 deletions src/pages/ValidateLoginPage/index.website.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,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
Expand Down

0 comments on commit 4cfa895

Please sign in to comment.