Skip to content

Commit

Permalink
Merge pull request #15882 from Expensify/OSBotify-cherry-pick-staging…
Browse files Browse the repository at this point in the history
…-15709

🍒 Cherry pick PR #15709 to staging 🍒
  • Loading branch information
OSBotify authored Mar 11, 2023
2 parents e9e6921 + f279140 commit e5e3edd
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 33 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001028203
versionName "1.2.82-3"
versionCode 1001028204
versionName "1.2.82-4"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.82.3</string>
<string>1.2.82.4</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.82.3</string>
<string>1.2.82.4</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.82-3",
"version": "1.2.82-4",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
17 changes: 5 additions & 12 deletions src/libs/actions/Session/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,7 @@ function signIn(password, validateCode, twoFactorAuthCode) {
},
];

const params = {twoFactorAuthCode};
if (credentials.login) {
// The user initiated the sign in operation on the current device, sign in with the email
params.email = credentials.login;
} else {
// The user is signing in with the accountID and validateCode from the magic link
params.accountID = credentials.accountID;
}
const params = {twoFactorAuthCode, email: credentials.login};

// Conditionally pass a password or validateCode to command since we temporarily allow both flows
if (validateCode) {
Expand All @@ -296,7 +289,7 @@ function signIn(password, validateCode, twoFactorAuthCode) {
API.write('SigninUser', params, {optimisticData, successData, failureData});
}

function signInWithValidateCode(accountID, validateCode) {
function signInWithValidateCode(accountID, validateCode, twoFactorAuthCode) {
const optimisticData = [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
Expand Down Expand Up @@ -336,10 +329,10 @@ function signInWithValidateCode(accountID, validateCode) {
},
];

// This is temporary for now. Server should login with the accountID and validateCode
API.write('SigninUser', {
validateCode,
API.write('SigninUserWithLink', {
accountID,
validateCode,
twoFactorAuthCode,
}, {optimisticData, successData, failureData});
}

Expand Down
18 changes: 5 additions & 13 deletions src/pages/ValidateLoginPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,21 @@ const defaultProps = {

class ValidateLoginPage extends Component {
componentDidMount() {
const accountID = lodashGet(this.props.route.params, 'accountID', '');
const validateCode = lodashGet(this.props.route.params, 'validateCode', '');
if (Permissions.canUsePasswordlessLogins(this.props.betas)) {
if (lodashGet(this.props, 'session.authToken', null)) {
if (lodashGet(this.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(this.accountID(), this.validateCode());
Session.signInWithValidateCodeAndNavigate(accountID, validateCode);
}
} else {
User.validateLogin(this.accountID(), this.validateCode());
User.validateLogin(accountID, validateCode);
}
}

/**
* @returns {String}
*/
accountID = () => lodashGet(this.props.route.params, 'accountID', '');

/**
* @returns {String}
*/
validateCode = () => lodashGet(this.props.route.params, 'validateCode', '');

render() {
return <FullScreenLoadingIndicator />;
}
Expand Down
8 changes: 7 additions & 1 deletion src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import styles from '../../../styles/styles';
import Button from '../../../components/Button';
import Text from '../../../components/Text';
Expand Down Expand Up @@ -175,7 +176,12 @@ class BaseValidateCodeForm extends React.Component {
formError: {},
});

Session.signIn('', this.state.validateCode, this.state.twoFactorAuthCode);
const accountID = lodashGet(this.props, 'credentials.accountID');
if (accountID) {
Session.signInWithValidateCode(accountID, this.state.validateCode, this.state.twoFactorAuthCode);
} else {
Session.signIn('', this.state.validateCode, this.state.twoFactorAuthCode);
}
}

render() {
Expand Down

0 comments on commit e5e3edd

Please sign in to comment.