diff --git a/src/components/ValidateCode/ValidateCodeModal.js b/src/components/ValidateCode/ValidateCodeModal.js index c356458dc877..344c3107b8cf 100644 --- a/src/components/ValidateCode/ValidateCodeModal.js +++ b/src/components/ValidateCode/ValidateCodeModal.js @@ -39,7 +39,7 @@ const defaultProps = { }; function ValidateCodeModal(props) { - const signInHere = useCallback(() => Session.signInWithValidateCode(props.accountID, props.code, null, props.preferredLocale), [props.accountID, props.code, props.preferredLocale]); + const signInHere = useCallback(() => Session.signInWithValidateCode(props.accountID, props.code, props.preferredLocale), [props.accountID, props.code, props.preferredLocale]); return ( diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js index 7f18d2861a35..cc832d63ff53 100644 --- a/src/libs/actions/Session/index.js +++ b/src/libs/actions/Session/index.js @@ -393,7 +393,7 @@ function signIn(password, validateCode, twoFactorAuthCode, preferredLocale = CON API.write('SigninUser', params, {optimisticData, successData, failureData}); } -function signInWithValidateCode(accountID, code, twoFactorAuthCode, preferredLocale = CONST.LOCALES.DEFAULT) { +function signInWithValidateCode(accountID, code, preferredLocale = CONST.LOCALES.DEFAULT, twoFactorAuthCode = '') { // If this is called from the 2fa step, get the validateCode directly from onyx // instead of the one passed from the component state because the state is changing when this method is called. const validateCode = twoFactorAuthCode ? credentials.validateCode : code; @@ -468,8 +468,8 @@ function signInWithValidateCode(accountID, code, twoFactorAuthCode, preferredLoc ); } -function signInWithValidateCodeAndNavigate(accountID, validateCode, twoFactorAuthCode, preferredLocale = CONST.LOCALES.DEFAULT) { - signInWithValidateCode(accountID, validateCode, twoFactorAuthCode, preferredLocale); +function signInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale = CONST.LOCALES.DEFAULT, twoFactorAuthCode = '') { + signInWithValidateCode(accountID, validateCode, preferredLocale, twoFactorAuthCode); Navigation.navigate(ROUTES.HOME); } diff --git a/src/pages/ValidateLoginPage/index.js b/src/pages/ValidateLoginPage/index.js index 2f6e9c07e6e4..97461b42ab92 100644 --- a/src/pages/ValidateLoginPage/index.js +++ b/src/pages/ValidateLoginPage/index.js @@ -49,7 +49,7 @@ class ValidateLoginPage extends Component { // because we don't want to block the user with the interstitial page. Navigation.goBack(false); } else { - Session.signInWithValidateCodeAndNavigate(accountID, validateCode, null, this.props.preferredLocale); + Session.signInWithValidateCodeAndNavigate(accountID, validateCode, this.props.preferredLocale); } } else { User.validateLogin(accountID, validateCode); diff --git a/src/pages/ValidateLoginPage/index.website.js b/src/pages/ValidateLoginPage/index.website.js index 4f048dc30659..24a736086357 100644 --- a/src/pages/ValidateLoginPage/index.website.js +++ b/src/pages/ValidateLoginPage/index.website.js @@ -83,7 +83,7 @@ class ValidateLoginPage extends Component { } // The user has initiated the sign in process on the same browser, in another tab. - Session.signInWithValidateCode(this.getAccountID(), this.getValidateCode(), null, this.props.preferredLocale); + Session.signInWithValidateCode(this.getAccountID(), this.getValidateCode(), this.props.preferredLocale); } componentDidUpdate() { diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js index c1e1dc0bc9ff..c250a15d7f4c 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js @@ -184,7 +184,7 @@ class BaseValidateCodeForm extends React.Component { const accountID = lodashGet(this.props, 'credentials.accountID'); if (accountID) { - Session.signInWithValidateCode(accountID, this.state.validateCode, this.state.twoFactorAuthCode, this.props.preferredLocale); + Session.signInWithValidateCode(accountID, this.state.validateCode, this.props.preferredLocale, this.state.twoFactorAuthCode); } else { Session.signIn('', this.state.validateCode, this.state.twoFactorAuthCode, this.props.preferredLocale); }